300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > html折叠 手风琴效果 jQuery制作效果超棒的手风琴折叠菜单

html折叠 手风琴效果 jQuery制作效果超棒的手风琴折叠菜单

时间:2019-11-14 22:18:10

相关推荐

html折叠 手风琴效果 jQuery制作效果超棒的手风琴折叠菜单

拉风的jQuery制作的手风琴折叠菜单,效果非常不错!这里是之前版本的改进版,主要是jquery代码改进

演示图:

main.js

$(function(){

var tmp = null,

$title = $('.title'),

$con = $('.title > ul');

$title.click(function(){

$(tmp).children('ul').slideUp().end().children('.arrow').removeClass('arrow-up');

$(this).children('ul').slideToggle().end().children('.arrow').addClass('arrow-up');

tmp = this;

});

$con.click(function(){

return false; // 阻止事件冒泡

});

});

index.html

jquery js css html 一、HTML5基础教程 HTML5基础教程1HTML5基础教程2HTML5基础教程3HTML5基础教程4HTML5基础教程5二、CSS3基础教程 CSS3基础教程1CSS3基础教程2CSS3基础教程3CSS3基础教程4CSS3基础教程5三、Javascript基础教程 Javascript基础教程1Javascript基础教程2Javascript基础教程3Javascript基础教程4Javascript基础教程5四、NodeJs基础教程 NodeJs基础教程1NodeJs基础教程2NodeJs基础教程3NodeJs基础教程4NodeJs基础教程5五、IOS基础教程 IOS基础教程1IOS基础教程2IOS基础教程3IOS基础教程4IOS基础教程5

style.css

/*globle*/

ul, li{

margin: 0;

padding: 0;

list-style-type: none;

}

a{

display: inline-block;

width: 100%;

height: 31px;

text-decoration: none;

color: #fff;

font-size: 13px;

}

a:hover{

background: #52718A;

}

/*sidebar*/

.sidebar{

width: 210px;

height: 335px;

margin: 50px auto;

border-radius: 5px;

font: 14px '新宋体';

color: #f4f4f4;

}

.title{

width: 95%;

line-height: 32px;

border-bottom: 1px solid #ccc;

background: #1ABC9C;

cursor: pointer;

}

.title > span{

margin-left: 10px;

}

/*in-sidebar*/

.in-sidebar{

width: 100%;

display: none;

}

.in-sidebar > li{

width: 100%;

height: 32px;

background: #34495E;

line-height: 32px;

text-align: center;

border-bottom: 1px solid #ddd;

}

/*arrow*/

.arrow{

float: right;

display: inline-block;

margin-right: 5px;

width: 20px;

height: 32px;

background: url(../img/down.png) no-repeat center;

}

.arrow-up{

background: url(../img/up.png) no-repeat center;

}

以上所述就是本文给大家分享的全部内容了,希望能够对大家学习jQuery有所帮助。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。