Forums

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 Re: “Jump to” links- Hiding the id name that shows in URL

#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;
});
});