• Hello,

    Is there a way to add ease-in and ease-out to the smooth scrolling after clicking on a link?

    There is got to be a way to add a code in the style.js?

    Maybe something else?

    Thank you

    Mat

    • This topic was modified 8 years, 1 month ago by mattsdll.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @mattsdll,

    You can open the onepress/assets/js/theme.js, find this function and change it as you want :

    function smoothScroll( element ) {
            if ( element.length <= 0 ) {
                return false;
            }
            jQuery("html, body").animate({
                scrollTop: ( jQuery( element ).offset().top - h) + "px"
            }, {
                duration: 800,
                easing: "swing",
                complete: function(){
                    window.current_nav_item = false;
                }
            });
        }

    Hope it helps!

    Thread Starter mattsdll

    (@mattsdll)

    If I want to change the acceleration (ease-in, ease-out), is it the word “swing” that I need to change?
    If so, what are the other words that I can use?

    Thank you!

    Mat

    Hi @mattsdll,

    Yes. You can try to replace it with easing: "ease-in",

    Thread Starter mattsdll

    (@mattsdll)

    Perfect, it works.

    Here is the full list of easings to use (in case anybody wants to change it also).
    (ease-in does not work):

    easeInSine
    easeOutSine
    easeInOutSine
    easeInQuad
    easeOutQuad
    easeInOutQuad
    easeInCubic
    easeOutCubic
    easeInOutCubic
    easeInQuart
    easeOutQuart
    easeInOutQuart
    easeInQuint
    easeOutQuint
    easeInOutQuint
    easeInExpo
    easeOutExpo
    easeInOutExpo
    easeInCirc
    easeOutCirc
    easeInOutCirc
    easeInBack
    easeOutBack
    easeInOutBack
    easeInElastic
    easeOutElastic
    easeInOutElastic
    easeInBounce
    easeOutBounce
    easeInOutBounce

    • This reply was modified 8 years, 1 month ago by mattsdll.

    Thanks @mattsdll ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Smooth scrolling’ is closed to new replies.