I'm building a web app that loads content with $.ajax and then injects the cont开发者_StackOverflow社区ent in a contentCol...
problem is every time this happens it scroll the browser down. Is there a global way to prevent this and just keep the scrollbar where the user was initially before calling the AJAX?
Thx
ok here's what worked... Not loving this bec it prevent the user from REFRESHing ajax content. I'd love it if you can one up me with something better and more elegant...
$('a').live('click', function() {
// Page Jump Prevention - Does the clicked on Hash differ from the currently loaded hash, if not return false
if (window.location.hash.split('#')[1] == this.href.split('#')[1]) {
//alert('Dude we already loaded this!')
return false;
}
});
精彩评论