umberto
umberto

Reputation: 11

Jquery scroll to anchor not working on Internet Explorer

I'm new with javascript and jquery. I'm using some premade stuff to put on my site. http://brainscuker.altervista.org/

When I click on the link to scroll down to the anchor, it intially goes to the right place, but soon after, it scroll back up.

It works fine on firefox and chrome.

The script I'm using is this.

$(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 for any eventual help!

Upvotes: 1

Views: 1466

Answers (1)

Rich Tomasso
Rich Tomasso

Reputation: 11

window.location.hash is buggy on IE. Currently working on a similar problem, have to use the scroll or scrollTo function to make it work.

Upvotes: 1

Related Questions