Reputation: 147
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
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
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
Upvotes: 2