MCPcopy Index your code
hub / github.com/SortableJS/Sortable / isScrolledPast

Function isScrolledPast

Sortable.js:327–345  ·  view source on GitHub ↗

* Checks if a side of an element is scrolled past a side of its parents * @param {HTMLElement} el The element who's side being scrolled out of view is in question * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom') * @param {

(el, elSide, parentSide)

Source from the content-addressed store, hash-verified

325 * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
326 */
327 function isScrolledPast(el, elSide, parentSide) {
328 var parent = getParentAutoScrollElement(el, true),
329 elSideVal = getRect(el)[elSide];
330
331 /* jshint boss:true */
332 while (parent) {
333 var parentSideVal = getRect(parent)[parentSide],
334 visible = void 0;
335 if (parentSide === 'top' || parentSide === 'left') {
336 visible = elSideVal >= parentSideVal;
337 } else {
338 visible = elSideVal <= parentSideVal;
339 }
340 if (!visible) return parent;
341 if (parent === getWindowScrollingElement()) break;
342 parent = getParentAutoScrollElement(parent, false);
343 }
344 return false;
345 }
346
347 /**
348 * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)

Callers 1

Sortable.jsFile · 0.70

Calls 3

getRectFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…