WordPress.org

Ready to get started?Download WordPress

Forums

Easy Smooth Scroll Links
Update the .js file (2 posts)

  1. froozeify
    Member
    Posted 2 years ago #

    Hi,

    When we click on an anchor the adress bar show : http://yoursite.com/article#anchor

    if you want to hide the #anchor in the adress bar, you can change the .js file to

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button not blockqoute. ]

    $(function(){
    
        $('a[href*=#]').click(function() {
    
        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
        && location.hostname == this.hostname) {
    
        var $target = $(this.hash);
    
        $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
    
        if ($target.length) {
    
        var targetOffset = $target.offset().top;
    
        $('html,body').animate({scrollTop: targetOffset}, 1000);
    
        return false;
    
        }
    
        }
    
        });
    
        });

    And now the adress display in the bar when you click on an anchor is : http://yoursite.com/article

    the #anchor disappears.

    If you want an example don't hesitate to ask me.

    Sincerly
    Froozeify
    [ Signature moderated. ]

    http://wordpress.org/extend/plugins/easy-smooth-scroll-links/

  2. martinjesus
    Member
    Posted 2 years ago #

    Hi,

    I've tried to replace all the code in the .js file for your code, in order to remove the # from the URL, but it does not work.

    Am I missing something?

    Thanks in advance for your response.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.