I’m trying to prevent the page jump when clicking on a link.
function anchorClick() {
e.preventDefault();
id = window.location.hash.substring(1);
$('.map_tabs').attr("style", "display:none");
if ( $('.map_tabs#' + id).length ) {
$('.map_tabs#' + id).attr("style", "display:block");
} else {
$('.page-link#contact-us').attr("style", "display:block")
$('.page-link#contact-us h2').text(id + ' Coming Soon');
}
}
$(document).ready(anchorClick);
$(document).on("click", "#mybase" , anchorClick);
I’ve tried adding e.preventDefault()
but it’s not stopping the page jump.