mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
b7ed2ce14f
commit
a238978c6e
1 changed files with 34 additions and 0 deletions
34
dashboard-ui/bower_components/emby-webcomponents/visibleinviewport.js
vendored
Normal file
34
dashboard-ui/bower_components/emby-webcomponents/visibleinviewport.js
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
define([], function () {
|
||||
|
||||
/**
|
||||
* Copyright 2012, Digital Fusion
|
||||
* Licensed under the MIT license.
|
||||
* http://teamdf.com/jquery-plugins/license/
|
||||
*
|
||||
* @author Sam Sehnert
|
||||
* @desc A small plugin that checks whether elements are within
|
||||
* the user visible viewport of a web browser.
|
||||
* only accounts for vertical position, not horizontal.
|
||||
*/
|
||||
function visibleInViewport(elem, partial, thresholdX, thresholdY) {
|
||||
|
||||
thresholdX = thresholdX || 0;
|
||||
thresholdY = thresholdY || 0;
|
||||
|
||||
var vpWidth = window.innerWidth,
|
||||
vpHeight = window.innerHeight;
|
||||
|
||||
// Use this native browser method, if available.
|
||||
var 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