Giter Site home page Giter Site logo

jquery-scrolltotop's Introduction

jQuery scrollToTop

The powerful jQuery plugin that creates a button help you scroll to page's top. Project page and demos
Download: jquery-scrollToTop-master.zip


Features

  • The plugin supports relative animations
  • The call to the plugin can be made in 2 different ways โ€” $().scrollTo( target, duration, settings ) or $().scrollTo( target, settings ).
  • Lightweight size โ€” 1 kb gzipped

Dependencies

Usage

Import this libraries:

  • jQuery
  • jquery-scrollToTop.min.js

And CSS:

  • jquery-scrollToTop.css - desirable if you have not yet connected one

Initialize scrollToTop:

$('body').scrollToTop();

Or initialize scrollToTop with custom settings:

$('body').scrollToTop({
     speed: 1000,
     easing: 'linear',
	 distance: 200,
	 text: 'Scroll To Top',
	 animation: 'fade', // fade, slide, none
	 animationSpeed: 500,
	 skin: null,
	 namespace: 'scrollToTop'
});

Settings

{
    // Optional property, set the speed scroll to page's top
    speed: 1000,

    //Optional property, set easing type
    easing: 'linear', 

    //Optional property, Distance from top before showing element (px)
    distance: 200,

    //Optional property, Text for element, can contain HTML
    text: 'Scroll To Top',

    //Optional property, set the type of animation ,options: fade slide none
    animation: 'fade',

    //Optional property, set animation speed
    animationSpeed: 500,

    //Optional property,  choose element's skin, more skins is coming soon
    skin: null,

    //Optional property,  Set a namespace for css class
    namespace: 'scrollToTop'
      
}

Public methods

jquery scrollToTop has different methods , we can use it as below :

// page will scroll to top
$('body').scrollToTop("jump");

// the plugin's function become disable
$('body').scrollToTop("disable");

// the plugin's function become enable
$('body').scrollToTop("enable");

//  remove Dom emement and unbound all events 
$('body').scrollToTop("destroy");

Browser support

jquery-scrollToTop is verified to work in Internet Explorer 7+, Firefox 2+, Opera 9+, Google Chrome and Safari browsers. Should also work in many others.

Mobile browsers (like Opera mini, Chrome mobile, Safari mobile, Android browser and others) is coming soon.

Changes

Version Notes
... ...

Author

amazingSurge

License

jQuery-scrollToTop plugin is released under the GPL licence.

jquery-scrolltotop's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.