侧边导航更改下拉效果。

This commit is contained in:
罗宪 2015-06-10 11:51:51 +08:00
parent 41b37107a3
commit ed4f09b6c1
2 changed files with 24 additions and 3 deletions

View File

@ -33,7 +33,19 @@ $(function() {
$(this).parent().parent().addClass('expand'); $(this).parent().parent().addClass('expand');
} }
}); });
$.easing['jswing'] = $.easing['swing'];
$.extend($.easing,{
easeInCirc: function (x, t, b, c, d) {
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d) {
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
}
});
var navFunc = { var navFunc = {
navStrArr: [], navStrArr: [],
init: function() { init: function() {
@ -124,19 +136,25 @@ $(function() {
var self = this; var self = this;
var title = self.listBox.find("h4"); var title = self.listBox.find("h4");
title.bind("click", function(e) { title.bind("click", function(e) {
var parent = $(this).parent(); var parent = $(this).parent(),
list=parent.find("ul");
if (parent.attr("open")) { if (parent.attr("open")) {
parent.removeAttr("open"); parent.removeAttr("open");
if (parent.index() == self.num) { if (parent.index() == self.num) {
$(this).addClass("current"); $(this).addClass("current");
} }
list.animate({marginTop:-list.height()},400,"easeInOutCirc",function (){
list.css({"display":"none"})
})
} else { } else {
parent.attr("open", true); parent.attr("open", true);
if (parent.index() == self.num) { if (parent.index() == self.num) {
$(this).removeClass("current"); $(this).removeClass("current");
} }
list.css({"display":"block","margin-top":-list.height()});
list.animate({marginTop:0},400,"easeInOutCirc")
} }
parent.find("ul").slideToggle(300); //parent.find("ul").slideToggle(300);
}); });
} }
}; };

View File

@ -456,6 +456,9 @@ footer ul li > a {
cursor: pointer; cursor: pointer;
transition: background .5s, border .5s; transition: background .5s, border .5s;
border-left: 3px solid transparent; border-left: 3px solid transparent;
position: relative;
z-index: 1;
background: #F9F9F9;
} }
.aside-container li>ul { .aside-container li>ul {