【发布时间】:2012-05-08 03:10:27
【问题描述】:
滚动动画后或单击任何菜单链接但它不起作用时,我正在为徽标制作动画。
我得到了这个用于动画滚动的代码:
jQuery(function() {
jQuery('a').bind('click',function(event){
var $anchor = jQuery(this);
jQuery('html, body').stop().animate({
scrollTop: jQuery($anchor.attr('href')).offset().top
}, 2000,'easeInOutExpo');
event.preventDefault();
});
});
然后,要为徽标设置动画,如果窗口位置发生变化,我会这样做:
jQuery(document).ready(function(){
jQuery(window).bind('scroll',function(){
var wscroll = jQuery(this).scrollTop();
if(wscroll > 500){
jQuery('#logo').delay(800).animate({
left:'+48px'
});
}else if(wscroll < 500){
jQuery('#logo').animate({
left:'-250px'
});
}
console.log(wscroll);
});
});
Here is例子
但这不起作用,根本不起作用。
感谢您提供一些指导。提前谢谢。
【问题讨论】: