博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jQuery简单手风琴效果(Accordion)学习总结
阅读量:6618 次
发布时间:2019-06-25

本文共 5724 字,大约阅读时间需要 19 分钟。

一、基本手风琴效果——参考jQuery UI官网(补充:这个是jQuery UI效果)

Section 1

Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

Section 2

Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

Section 3

Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

  • List item one
  • List item two
  • List item three

Section 4

Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est.

Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

二、其他简单代码

三、带弹性减震效果——使用了easing插件

jQuery代码

$(document).ready(function(){    /* This code is executed after the DOM has been completely loaded */    /* Changing thedefault easing effect - will affect the slideUp/slideDown methods: */    $.easing.def = "easeOutBounce";    /* Binding a click event handler to the links: */    $('li.button a').click(function(e){            /* Finding the drop down list that corresponds to the current section: */        var dropDown = $(this).parent().next();                /* Closing all other drop down sections, except the current one */        $('.dropdown').not(dropDown).slideUp('slow');        dropDown.slideToggle('slow');                /* Preventing the default event (which would be to navigate the browser to the link's address) */        e.preventDefault();    })    });

 四、手风琴菜单效果

jquery

$(document).ready(function(e){    $("#nav-accordion").hide();    $("#menu-button").click(function(){        $("#nav-accordion").slideToggle();                $('#accordion > ul:eq(0)').show();    });                $("#accordion > li:eq(1)").click(function(){        if(false == $(this).next().is(':visible')) {               $('#accordion > ul').slideUp(500);        }        $(this).next().slideToggle(500);    });        $("#accordion ul > li ").click(function(){        if(false == $(this).next().is(':visible')) {            $('#accordion ul > ul').slideUp(500);        }        $(this).next().slideToggle(500);    });});

 

 

 

 

转载于:https://www.cnblogs.com/JoannaQ/archive/2012/10/06/2712710.html

你可能感兴趣的文章
SpringMVC通过@autowired自动装载Service时提示装载错误
查看>>
ajax与spring mvc请求的总结
查看>>
百度API
查看>>
指南:在Github和Git上如何Fork
查看>>
i3 窗口管理器使 Linux 更美好
查看>>
动画_Interpolator(插值器)
查看>>
基于Centos7.2的DNS服务器搭建
查看>>
Sass--混合指令 (Mixin Directives)
查看>>
学习笔记DL005:线性相关、生成子空间,范数,特殊类型矩阵、向量
查看>>
MySQL同表更新与查询冲突
查看>>
Java编程思想(static关键字)
查看>>
北京云栖大会 Tech Insight 金融级分布式架构分享一览
查看>>
推荐一个有趣的Chrome扩展程序-查看任意网站的开发技术栈
查看>>
Apache默认虚拟主机
查看>>
商城系统针对开发者自有支付系统提供的解决方案
查看>>
mysql load data 批量导入使用
查看>>
在guns框架和SpringBoot框架中展现视频列表遇到的坑
查看>>
108.构建maven项目
查看>>
【Stimulsoft购买指南】授权和订阅常见问题
查看>>
TeeChart Pro VCL/FMX教程(二):图表显示属性(General和Axis篇)
查看>>