MCPcopy Create free account
hub / github.com/hoothin/UserScripts / getScrolled

Function getScrolled

FlashViewer-HTML5 Video/flashViewer.user.js:288–304  ·  view source on GitHub ↗
(container)

Source from the content-addressed store, hash-verified

286
287 //获取已滚动的距离
288 function getScrolled(container) {
289 if (container) {
290 return {
291 x:container.scrollLeft,
292 y:container.scrollTop,
293 };
294 };
295 /*
296 window.scrollX,scollY的值是可以被覆盖的,不靠谱
297 */
298 var de = document.documentElement;
299 var body = document.body;
300 return {
301 x: 'pageXOffset' in window ? window.pageXOffset : de.scrollLeft || body.scrollLeft,
302 y: 'pageYOffset' in window ? window.pageYOffset : de.scrollTop || body.scrollTop,
303 };
304 };
305
306 // 事件支持检测.
307 // 比如 eventSupported('fullscreenchange', document);

Callers 1

contentScriptFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected