1.0.1 • Published 7 years ago

@axn/jquery-backtotop v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

jQuery "back to top" plugin

Install

With NPM run the following command:

npm install @axn/jquery-backtotop --save

Usage

Load the script:

<script src="jquery.js"></script>
<script src="jquery.backtotop.js"></script>

Put a button:

<button id="btn-back-to-top">Back to top</button>

Position it:

#btn-back-to-top {
    position: fixed;
    bottom: 15px;
    right: 15px;
    display: none;
}

Run the script:

(function($) {
    $('#btn-back-to-top').backtotop();
})(jQuery);

With options:

(function($) {
    $('#btn-back-to-top').backtotop({
        showAt: 200,
        fadeInDelay: 400,
        fadeOutDelay: 400,
        scrollTopDelay: 600
    });
})(jQuery);