owen
owen

Reputation: 147

Anchor Tag in chrome not working properly?Is this a chrome Bug?

I have a site http://rethinkwaste.com.au/ . When clicking on the very first slide I have a anchor set up

<div id="illegal"></div>

On the first load out in google chrome this seems to jump back up to the top of the page. Is this a chrome bug?

If I then refresh or load page from slider link it seems to work ok.

Upvotes: 3

Views: 6021

Answers (2)

Ismail Farooq
Ismail Farooq

Reputation: 6827

I think its a Chrome bug. So After some searching i found this solution.

jQuery(window).load(function(){
    var hashNum = 0;
    if (window.location.hash != ''){
        hashNum = window.location.hash.replace("#illegal", "");   
        console.log('hashNum: ' + hashNum); 
    };
    hashMenu = jQuery("#illegal").offset().top;
      jQuery('html,body').animate({
          scrollTop: hashMenu
    }, 1000);

});

Upvotes: 3

Rohit
Rohit

Reputation: 1812

Issue might be due to duplicate id #illegal, from your website code I can see this id used twice. Remove unwanted or use unique id and try. It should work

enter image description here

Upvotes: 2

Related Questions