Below is the code snippet I am working with:
$( document ).ready(function() {
$( '.prevent-default' ).click(function( event ) {
event.preventDefault();
});
});
To prevent the window from jumping when a hashed anchor link is clicked, I have assigned the class .prevent-default
to them. However, this also prevents the browser from following the link as well.
Is there a way to only prevent the window jump but still allow the link to be followed?
I attempted using
window.location.href = jQuery( this ).attr('href');
, but unfortunately that did not work as intended - the window still jumped.