Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (33 sloc) 1.62 KB



Arwid Bancewicz




8 Jan 2013

Similar to the default browser scrollIntoView, this jQuery plugin scrolls an element into view to the top or bottom of its container but not if it's already visible. The demo page is here


An animated scroll:


No animation:


Configure the animation (same options as in jQuery animate()):

$("#some_element").scrollIntoView(250, "easeOutExpo", function() { alert("done scroll!") });

  duration: true,
  complete: $.noop(),
  step: $.noop(),
  queue: false,
  specialEasing: null

Same for multiple elements:

  • Refer to for a description of the options.

  • By default the animation easing will be 'easeOutExpo' if jQuery UI Effects is included before this file. Otherwise, it'll use jQuery's default 'swing' easing which isn't great. So make sure to download Effects Core from and include it before this file for a better animation.

Also Included

Also included is a utility method isOutOfView that works for multiple elements:


Or for completely out of view:


Also included is a utility called commonAncestor which returns the common ancestor of elements:



jQuery.scrollIntoView is covered by the MIT License.