Home › Forums › CSS › “Jump to” links- Hiding the id name that shows in URL › Re: “Jump to” links- Hiding the id name that shows in URL
June 9, 2012 at 8:35 am
#104135
Taufik Nurrohman
Participant
Yes. You can use .scrollTop()
to scroll the viewport based on the element offset: http://jsfiddle.net/tovic/kw7LD/7/show/
$(function() {
$('a[href^="#"]').click(function() {
$('html,body').scrollTop($($(this).attr('href')).offset().top);
return false;
});
});