jQuery: disable autoscrolling to top when click on anchor

advertisement

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:

Turn on MySQL query cache to speed up query performance?
How to install LAMP (Apache, PHP and MySQL in Linux) using Yum
How to install Fedora to USB drive
How to import mysql innodb with foreign key constraint error?
How to detect checkbox being checked using javascript
Symfony: PHP Fatal error: Call to a member function setData()
Symfony Filter: Change ForeignKey drop down to Text field
MySQL: Full text search for multiple words






Leave a Reply