1

scroll to top is not working with turbolinks

$(document).ready(function(){   
    $(window).scroll(function () {
        if ($(this).scrollTop() > 800) {
            $('#scroll-to-top').fadeIn();
        } else {
            $('#scroll-to-top').fadeOut();
        }
    });
    $('#scroll-to-top').click(function () {
        $('body,html').animate({
            scrollTop: 0
        }, 400);
        return false;
    });
});

I tried to use data-no-turbolink in a button, but it doesn't help me.

4

0 回答 0