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

你可能感兴趣的文章
超适合小白的python新手教程
查看>>
年过四十、零基础学前端开发,歪果仁是如何从教师转行程序员的?
查看>>
教你大数据必修三大技能 快快记录下来
查看>>
网络卡顿怎么办?
查看>>
Factom(公证通)--基于区块链的存证系统
查看>>
prezi,mfc,toefl,java
查看>>
Software AG成功整合Terracotta
查看>>
centos中进程管理工具
查看>>
【Prince2科普】Prince2的七大原则(7)
查看>>
从【BZOJ4173】谈做题技巧
查看>>
学JS的心路历程-函式(六)其余参数及预设参数
查看>>
[Ting's笔记Day1] Ruby on Rails练习- MacOS安装篇
查看>>
TJOI2015 旅游
查看>>
监听器实现案例----自定义session扫描器和统计在线用户人数及用户信息
查看>>
多继承
查看>>
.net4 DataAnnotations小试(转帖)
查看>>
怎么看性能瓶颈?
查看>>
解决淘淘商城“拦截器处理请求”的一个错误
查看>>
【javascript基础】1、基本概念
查看>>
IE setAttribute frameborder 相关
查看>>