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

你可能感兴趣的文章
Linux下pathInfo的配置说明(Thinkphp)
查看>>
IP (复习)
查看>>
【直通BAT】java容器考点总结和源码剖析
查看>>
Xcode10 这个图片是如何加载的啊
查看>>
PHP-送给想学PHP的小伙伴们
查看>>
contos7安装及忘记root密码修改
查看>>
笔记(流)
查看>>
企业如何用短信平发送营销类短信
查看>>
Linux系统值得一看的学习方法及路线图
查看>>
《Linux就该这么学》双十一半价发售
查看>>
(16)-华为交换机端口镜像配置
查看>>
Kubuntu 18.10 开发重点迁移至ARM与X64平台
查看>>
DDR内存参数笔记
查看>>
static_cast, dynamic_cast和reinterpret_cast的区别
查看>>
第六章:thymeleaf页面模版-3. 处理内置对象
查看>>
鼠标移动可改变DIV的大小
查看>>
为什么你需要将代码迁移到ASP.NET Core 2.0?
查看>>
第二周实习小记-----大牛离我们有多远
查看>>
SpringMVC通过@autowired自动装载Service时提示装载错误
查看>>
ajax与spring mvc请求的总结
查看>>