Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions jquery.scrollintoview.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
};
};

var currentScroller = null;

$.fn.extend({
scrollintoview: function (options) {
/// <summary>Scrolls the first element in the set into view by scrolling its closest scrollable parent.</summary>
Expand Down Expand Up @@ -142,10 +144,16 @@
{
scroller = $("html,body");
}
if (currentScroller)
{
currentScroller.stop();
}
currentScroller = scroller;
scroller
.animate(animOptions, options.duration)
.eq(0) // we want function to be called just once (ref. "html,body")
.queue(function (next) {
currentScroller = null;
$.isFunction(options.complete) && options.complete.call(scroller[0]);
next();
});
Expand Down
2 changes: 1 addition & 1 deletion jquery.scrollintoview.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.