mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
First separation commit.
Added LICENSE, README.md, CONTRIBUTORS.md
This commit is contained in:
parent
09513af31b
commit
4678528d00
657 changed files with 422 additions and 0 deletions
19
src/bower_components/emby-webcomponents/visibleinviewport.js
vendored
Normal file
19
src/bower_components/emby-webcomponents/visibleinviewport.js
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
define(["dom"], function(dom) {
|
||||
"use strict";
|
||||
|
||||
function visibleInViewport(elem, partial, thresholdX, thresholdY) {
|
||||
if (thresholdX = thresholdX || 0, thresholdY = thresholdY || 0, !elem.getBoundingClientRect) return !0;
|
||||
var windowSize = dom.getWindowSize(),
|
||||
vpWidth = windowSize.innerWidth,
|
||||
vpHeight = windowSize.innerHeight,
|
||||
rec = elem.getBoundingClientRect(),
|
||||
tViz = rec.top >= 0 && rec.top < vpHeight + thresholdY,
|
||||
bViz = rec.bottom > 0 && rec.bottom <= vpHeight + thresholdY,
|
||||
lViz = rec.left >= 0 && rec.left < vpWidth + thresholdX,
|
||||
rViz = rec.right > 0 && rec.right <= vpWidth + thresholdX,
|
||||
vVisible = partial ? tViz || bViz : tViz && bViz,
|
||||
hVisible = partial ? lViz || rViz : lViz && rViz;
|
||||
return vVisible && hVisible
|
||||
}
|
||||
return visibleInViewport
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue