Search code examples
javascriptwordpressscroll

Wordpress Twenty Seventeen: How to customize the "scroll down arrow" Javascript file


WordPress' Twenty Seventeen theme comes bundled with a small arrow on the bottom-right of the screen who's class is menu-scroll-down. It makes a smooth scrolling effect to the content. I'd like to customize the scrolling speed.

I've found the JavaScript file in assets\js\jquery.scrollTo.js, but I'm not sure I'm at the right place, and I can't seem to make the changes I want. I can't find where in the JavaScript is the .menu-scroll-down class mentioned, either.

Does anyone know where to change these parameters?


Solution

  • Find global.js that is in the same directory as assets\js\jquery.scrollTo.js then find the following code

    $menuScrollDown.click( function( e ) {
        e.preventDefault();
        $( window ).scrollTo( '#primary', {
                duration: 600,
                offset: { top: menuTop - navigationOuterHeight }
        });
    });
    

    and then change the duration to change the scroll speed.

    https://themes.trac.wordpress.org/browser/twentyseventeen/1.4/assets/js/global.js#L200