Prevent # href Page Jumping

Prevent # href Page Jumping

Many JQuery toggles are controlled by ‘a’ links with ‘#’ href values however when clicked they can make the page jump.

This simple code will lock the page position:

//Prevent page jumping to top on # click
$("a.submenu-button").click(function(e) {
e.preventDefault();
});

Comments are closed.