• Hello,
    i need to add jQuery smooth scroll for scrolling my pages , i want make it without WP plug in.

    can someone tell how can do it?

    thank you
    regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • Have you reviewed using wp_enqueue_script()?

    Thread Starter epd

    (@epd)

    yes ,
    but i was looking the code to put in my file .js

    I have found this and it work

    $(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 -100;
                    $('html,body').animate({scrollTop: targetOffset}, 800); // change number for scroll speed, higher = slower
                    return false;
                }
            }
        });
    });
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to add jQuery smooth scroll’ is closed to new replies.