How do I prevent auto scroll to a certain element when I click on that?
I have a page where when I click on a menu item, it will load the content using anchor tag navigation. This means I use # on the address bar to prevent loading the whole page using ajax.
My problem is that whenever I click on a menu button, before the new content is loaded, the window automatically scrolls to the position of the menu item I clicked.
I know this can be "solved" by window.scrollTo(0,0) but I don't want to see scroll jumping around whenever I load a content.
note: I have no idea where this is happening s开发者_开发技巧o I can't really post my code...
$('.link').click(function(ev){
//....Ajax stuff
ev.preventDefault();
});
精彩评论