博客
关于我
强烈建议你试试无所不能的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

你可能感兴趣的文章
搭建centos6.7网站服务器记录
查看>>
Release版本调用ffmpeg av_register_all程序崩溃
查看>>
Referenced management pack not found
查看>>
jquery中data函数的用法示例
查看>>
巧用strtotime函数计算日期
查看>>
JVM中java对象的生命周期
查看>>
mysql 查看连接数,状态
查看>>
JFinal集成YUI Compressor压缩合并JS和CSS
查看>>
windows下的Oracle卸载
查看>>
sqlserver查看死锁的存储过程
查看>>
在VirtualBox中的CentOS 6.3下安装VirtualBox增强包(GuestAd...
查看>>
Java开发中的23种设计模式详解(转)
查看>>
我的友情链接
查看>>
关于Android中的数据存储
查看>>
Tomcat配置日志生产功能
查看>>
移植Qt与Tslib到X210开发板的体会
查看>>
Nginx + webpy 和FastCGI搭建webpy环境
查看>>
使用JdbcTemplate过程中使用到多个参数和like模糊
查看>>
解决eclipse中无法删除Tomcat服务器中的项目,报maven is required and cannot be removed from the server错误情况...
查看>>
修改页面JS 360浏览器
查看>>