admin 管理员组

文章数量: 887021


2023年12月18日发(作者:数据库原理与应用实验报告)

基于html5代码实现折叠菜单附源码下载,效果逼真,非常方便使用,对html5折叠菜单感兴趣的朋友可以参考下

hmtl代码:

代码如下:

<div class="container">

<div class="card-drop">

<a class='toggle' href="#">

<i class='fa fa-suitcase'></i>

<span class='label-active'>爱编程</span>

</a>

<ul>

<li class='active'>

<a data-label="Everyting" href="#"><i class='fa fa-suitcase'></i> 爱编程</a>

</li>

<li>

<a data-label="Design" href="#"><i class='fa fa-magic'></i> jQuery特效</a>

</li>

<li>

<a data-label="UI-UX" href="#"><i class='fa fa-bolt'></i> CSS3特效</a>

</li>

<li>

<a data-label="Print" href="#"><i class='fa fa-tint'></i> HTML5特效</a>

</li>

<li>

<a data-label="Photography" href="#"><i class='fa fa-camera-retro'></i>

音效下载</a>

</li>

<li>

<a data-label="Photography" href="#"><i class='fa fa-camera-retro'></i>

flash动画</a>

</li>

</ul>

</div>

</div>

js代码:

代码如下:

(function ($) {

var cards = $('.card-drop'), toggler = ('.toggle'), links = ('ul>li>a'), li

= ('li'), count = , width = 100;

(function (i) {

$(this).css('z-index', count - i);

});

function setClosed() {

(function (index) {

$(this).css('top', index * 4).css('width', width - index * 0.5 + '%').css('margin-left', index *

0.25 + '%');

});

ss('closed');

Class('active');

}

setClosed();

('mousedown', function () {

var $this = $(this);

if ($('.active')) {

setClosed();

} else {

$ss('active');

Class('closed');

(function (index) {

$(this).css('top', 60 * (index + 1)).css('width', '100%').css('margin-left', '0px');

});

}

});

('click', function (e) {

var $this = $(this), label = $('label');

icon = $en('i').attr('class');

Class('active');

if ($('li').is('active')) {

$('li').removeClass('active');

} else {

$('li').addClass('active');

}

en('span').text(label);

en('i').removeClass().addClass(icon);

setClosed();

tDefault;

});

}(jQuery));


本文标签: 折叠 菜单 下载 源码 数据库