Created
March 3, 2014 15:11
-
-
Save zhoumengkang/9327001 to your computer and use it in GitHub Desktop.
滚动的bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var flag = false; | |
$(window).scroll(function() { | |
console.log(flag); | |
if(flag){ | |
return false; | |
} | |
if($(window).scrollTop()==0){ | |
//恢复 | |
flag = true; | |
$(".sign").fadeOut('100',function(){ | |
$("#intro").fadeIn('slow') | |
}); | |
$("#header").removeClass('fixed_top').animate({ | |
"height": "96px" | |
}).find(".logo").animate({ | |
"font-size": "40px", | |
"line-height": "96px" | |
}).parent().parent().find(".nav").animate({ | |
"line-height": "40px", | |
"padding":0, | |
"margin-top":"28px", | |
"margin-bottom":"28px" | |
},function(){ | |
flag = false; | |
}); | |
}else{ | |
flag = true; | |
if($("#header").hasClass('fixed_top')){ | |
return false; | |
} | |
$("#header").addClass('fixed_top').animate({ | |
"height": "46px" | |
},500).find(".logo").animate({ | |
"font-size": "28px", | |
"line-height": "46px" | |
}).parent().parent().find(".nav").animate({ | |
"line-height": "46px", | |
"padding":0, | |
"margin-top":0, | |
"margin-bottom":0 | |
},function(){ | |
flag = false; | |
}); | |
$("#intro").hide(function(){ | |
$(".sign").css({"padding-top":"15px"}).show(); | |
}); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment