I've had a look at the answers to this question, and they're not working.
I believe this is because our site navigation prefixes anchor links with the domain, to ensure the correct page with the anchor tag is loaded (as the links are in the global navigation).
i.e, instead of having links like <a href="#anchor">link</a>
, we have links like <a href="http://example.com/#anchor">link</a>
How can the answers to the above question be altered to work when the anchor link is prefixed with a domain?
Help appreciated.
Update:
From Amal's answer, I have added:
<script>
jQuery(document).on("click",".consult-header .consult-primary-menu li a",function(event){
event.preventDefault();
var thishref =jQuery(this).attr("href");
var url = thishref.substr(thishref.indexOf("#"));
jQuery('html, body').animate({
scrollTop: $(url).offset().top
}, 2000);
});
</script>
The links to anchors inside the home page work, but the links to internal sub pages do not work - clicking these links does nothing, even though the status bar indicates a link is detected.