I have a webpage with multiple DIV elements. If i use the jquery function SlideUp to hide one (which is towards the bottom of the page), the page automatically scrolls back to the top. How can I prevent this?
To trigger the jquery function, I do something like this:
$(MyLink).click(function() {
MyDiv.slideUp("slow");
}
MyLink being within MyDiv which is somewhere in the middle of the page.
How do you trigger the jquery function, via anchors? If so, have the function return false, otherwise the browser will redirect to the href-attribute, which would be '#' in this case.
What I did was what someone suggested (adding return false) and it worked:
$(MyLink).click(function() {
MyDiv.slideUp("slow");
return false;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With