Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

gallery-2010.01.13-20 jafl gallery-scrollintoview

  • Loading branch information...
commit 940702888437c4285cab600ed0c296997878138c 1 parent f5d3e5d
YUI Builder authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/gallery-scrollintoview/js/ScrollIntoView.js
View
10 src/gallery-scrollintoview/js/ScrollIntoView.js
@@ -1,3 +1,5 @@
+"use strict";
+
/**********************************************************************
* <p>Only scrolls the browser if the object is not currently visible.</p>
*
@@ -5,7 +7,7 @@
* Otherwise, this algorithm will skip over them with unpredictable
* results.</p>
*
- * @method scrollIntoView
+ * @chainable
*/
Y.Node.prototype.scrollIntoView = function()
@@ -13,7 +15,7 @@ Y.Node.prototype.scrollIntoView = function()
var ancestor = Y.Node.getDOMNode(this.get('offsetParent'));
if (!ancestor)
{
- return;
+ return this;
}
var r =
@@ -49,7 +51,7 @@ Y.Node.prototype.scrollIntoView = function()
}
else if (hit_top)
{
- return;
+ return this;
}
r.move(ancestor.offsetLeft - ancestor.scrollLeft, ancestor.offsetTop - ancestor.scrollTop);
@@ -105,4 +107,6 @@ Y.Node.prototype.scrollIntoView = function()
ancestor = ancestor.offsetParent;
}
}
+
+ return this;
}
Please sign in to comment.
Something went wrong with that request. Please try again.