jQuery: disable autoscrolling to top when click on anchor


jqueryIf u r building website with jQuery, it’s common if the browser auto scroll to top when user click on anchor element. This happen to me many times and i always forget how to disable the auto scrolling. Thus this post is being created for my own reference and for other developer :)

To disable autoscrolling to top when user click on anchor element, follow the steps below:

  • In the same page, copy and paste this script within your script tag
  • Now refresh you page and you may try to click on anchor element and the autoscrolling should be stop by now

Happy coding!

Related posts:

MySQL: How to add column to existing table
How to create mailing list in Thunderbird
How to install Fedora to USB drive
How to disable ssh root login?
Symfony 1.4: How to sort foreign key record?
How to delete table row using jQuery
How to add native menu support in your WordPress theme?
WordPress Plugin Dev: How to send email using SMTP?

Leave a Reply