2011-05-25 92 views
1

我是新来的JavaScript和jQuery。我正在使用一些预制的东西放在我的网站上。 http://brainscuker.altervista.org/jquery滚动到锚点不工作在Internet Explorer上

当我点击链接向下滚动到锚点时,它实际上会去正确的位置,但不久之后,它会向上滚动。

它适用于Firefox和Chrome。

我正在使用的脚本是这样的。

$(document).ready(function() { 
    $("a.who").anchorAnimate() 
}); 

jQuery.fn.anchorAnimate = function(settings) { 

settings = jQuery.extend({ 
    speed : 800 
}, settings); 

return this.each(function(){ 
    var caller = this 
    $(caller).click(function (event) { 
     event.preventDefault() 
     var locationHref = window.location.href 
     var elementClick = $(caller).attr("href") 

     var destination = $(elementClick).offset().top; 
     $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() { 
      window.location.hash = elementClick 
     }); 
     return false; 
    }) 
}) 
} 

thx任何最终的帮助!

+1

哪个版本的ie? – Kraz 2011-05-25 17:09:41

回答

1

window.location.hash在IE上有问题。目前正在处理类似的问题,必须使用scroll或scrollTo函数来使其工作。