GithubHelp home page GithubHelp logo

jquery.scrollto's Introduction

jQuery.ScrollTo

Installation and usage

Using bower:

bower install jquery.scrollTo

Notes

  • Apart from the target and duration, the plugin can receive a hash of settings. Documentation and examples are included in the source file.

  • If you are interested in animated "same-page-scrolling" using anchors(href="#some_id"), check http://github.com/flesler/jquery.localScroll

  • For a slideshow-like behavior using scrolling, check http://github.com/flesler/jquery.serialScroll

  • The target can be specified as:

    • A Number/String specifying a position using px or just the number.
    • A string selector that will be relative, to the element that is going to be scrolled, and must match at least one child.
    • A DOM element, logically child of the element to scroll.
    • A hash { top:x, left:y }, x and y can be any kind of number/string like described above.
  • The plugin supports relative animations

  • 'em' and '%' are not supported as part of the target, because they won't work with jQuery.fn.animate.

  • The plugin might fail to scroll an element, to an inner node that is nested in more scrollable elements. This seems like an odd situation anyway.

  • Both axes ( x, y -> left, top ) can be scrolled, you can send 'x', 'y', 'xy' or 'yx' as 'axis' inside the settings.

  • If 2 axis are scrolled, there's an option to queue the animations, so that the second will start once the first ended ('xy' and 'yx' will have different effects)

  • The option 'margin' can be setted to true, then the margin of the target element, will be taken into account and will be deducted.

  • 'margin' will only be valid, if the target is a selector, a DOM element, or a jQuery Object.

  • The option 'offset' allows to scroll less or more than the actual target by a defined amount of pixels. Can be a number(both axes) or { top:x, left:y }.

  • The option 'over' lets you add or deduct a fraction of the element's height and width from the final position. so over:0.5 will scroll to the middle of the object. can be specified with {top:x, left:y}

  • Don't forget the callback event is now called 'onAfter', and if queuing is activated, then 'onAfterFirst' can be used.

  • If the first axis to be scrolled, is already positioned, that animation will be skipped, to avoid a delay in the animation.

  • The call to the plugin can be made in 2 different ways: $().scrollTo( target, duration, settings ) or $().scrollTo( target, settings ). Where one of the settings is 'duration'.

  • If you find any bug, or you have any advice, don't hesitate to open an issue.

jquery.scrollto's People

Contributors

flesler avatar buzzedword avatar jeffreyatw avatar adjohn avatar

Watchers

James Cloos avatar Jairo Mejia 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.