Skip to content

danieledesantis/jquery-scrolltop-button

Repository files navigation

jQuery scrolltop button plugin

jQuery plugin that adds a fading "back to top" button to a page.

Installation

Include the production file after jquery.

<script src="/path/jquery-latest-version.js"></script>
<script src="/path/jquery.scrolltop.button.min.js"></script>

Usage

HTML

Create a div element

<div id="my_button"></div>

jQuery

Initialize the plugin

$(window).load(function() {
		$('#my_button').scrollTopButton();
});

Options

scrollHeight

Scrolling distance from the top at which the button appears. Deafult: 300

scrollDuration

Scrolltop duration. Default:500

customCss

Apply your custom css styles for the button. Default: 0

Example with custom options

$(window).load(function() {
		
		$('#my_button').scrollTopButton({
			scrollHeight         : 800,
			scrollDuration       : 1000,
			customCss            : 1 // Define your custom styles for the button in your css file	
		});

});

About

jQuery plugin that adds a fading "back to top" button to a page

Resources

License

Stars

Watchers

Forks

Packages

No packages published