The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › “Jump to” links- Hiding the id name that shows in URL
I’m using “jump-to” links. When clicked on, the div id shows up in the url, ie “www.mysite.com/#8”. Is there any way to hide this?
Yes. You can use .scrollTop() to scroll the viewport based on the element offset: http://jsfiddle.net/tovic/kw7LD/7/show/
.scrollTop()
$(function() { $('a[href^="#"]').click(function() { $('html,body').scrollTop($($(this).attr('href')).offset().top); return false; }); });