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

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #38425
    alee004
    Participant

    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?

    #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;
    });
    });
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.