MCPcopy Index your code
hub / github.com/hoothin/UserScripts / getScrolled

Function getScrolled

Picviewer CE+/dist.user.js:13632–13643  ·  view source on GitHub ↗
(container)

Source from the content-addressed store, hash-verified

13630
13631 //获取已滚动的距离
13632 function getScrolled(container){
13633 if(container){
13634 return {
13635 x:container.scrollLeft,
13636 y:container.scrollTop,
13637 };
13638 }
13639 return {
13640 x:'scrollX' in window ? window.scrollX : ('pageXOffset' in window ? window.pageXOffset : document.documentElement.scrollLeft || getBody(document).scrollLeft),
13641 y:'scrollY' in window ? window.scrollY : ('pageYOffset' in window ? window.pageYOffset : document.documentElement.scrollTop || getBody(document).scrollTop),
13642 };
13643 }
13644
13645 //xpath 获取单个元素
13646 function getElementByXpath(xpath,contextNode,doc){

Callers 2

initFunction · 0.70
mouseupHandlerFunction · 0.70

Calls 1

getBodyFunction · 0.70

Tested by

no test coverage detected