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

Function isScrolledPast

src/utils.js:284–307  ·  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 {String

(el, elSide, parentSide)

Source from the content-addressed store, hash-verified

282 * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
283 */
284function isScrolledPast(el, elSide, parentSide) {
285 let parent = getParentAutoScrollElement(el, true),
286 elSideVal = getRect(el)[elSide];
287
288 /* jshint boss:true */
289 while (parent) {
290 let parentSideVal = getRect(parent)[parentSide],
291 visible;
292
293 if (parentSide === 'top' || parentSide === 'left') {
294 visible = elSideVal >= parentSideVal;
295 } else {
296 visible = elSideVal <= parentSideVal;
297 }
298
299 if (!visible) return parent;
300
301 if (parent === getWindowScrollingElement()) break;
302
303 parent = getParentAutoScrollElement(parent, false);
304 }
305
306 return false;
307}
308
309
310

Callers 1

Sortable.jsFile · 0.90

Calls 3

getRectFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…