SimpleTaskSystem.Web/Content/theme/Js/arale/position/1.0.1/position.js

(完整代码) 1KB

define("arale/position/1.0.1/position",["$"],function(a,b){function c(a){a=h(a)||{},a.nodeType&&(a={element:a});var b=h(a.element)||k;if(1!==b.nodeType)throw new Error("posObject.element is invalid.");var c={element:b,x:a.x||0,y:a.y||0},d=b===k||"VIEWPORT"===b._id;return c.offset=function(){return m?{left:0,top:0}:d?{left:l(document).scrollLeft(),top:l(document).scrollTop()}:i(l(b)[0])},c.size=function(){var a=d?l(window):l(b);return{width:a.outerWidth(),height:a.outerHeight()}},c}function d(a){a.x=e(a.x,a,"width"),a.y=e(a.y,a,"height")}function e(a,b,c){if(a+="",a=a.replace(/px/gi,""),/\D/.test(a)&&(a=a.replace(/(?:top|left)/gi,"0%").replace(/center/gi,"50%").replace(/(?:bottom|right)/gi,"100%")),-1!==a.indexOf("%")&&(a=a.replace(/(\d+(?:\.\d+)?)%/gi,function(a,d){return b.size()[c]*(d/100)})),/[+\-*\/]/.test(a))try{a=new Function("return "+a)()}catch(d){throw new Error("Invalid position value: "+a)}return g(a)}function f(a){var b=a.offsetParent();b[0]===document.documentElement&&(b=l(document.body)),o&&b.css("zoom",1);var c;return c=b[0]===document.body&&"static"===b.css("position")?{top:0,left:0}:i(b[0]),c.top+=g(b.css("border-top-width")),c.left+=g(b.css("border-left-width")),c}function g(a){return parseFloat(a,10)||0}function h(a){return l(a)[0]}function i(a){var b=a.getBoundingClientRect(),c=document.documentElement;return{left:b.left+(window.pageXOffset||c.scrollLeft)-(c.clientLeft||document.body.clientLeft||0),top:b.top+(window.pageYOffset||c.scrollTop)-(c.clientTop||document.body.clientTop||0)}}var j=b,k={_id:"VIEWPORT",nodeType:1},l=a("$"),m=!1,n=(window.navigator.userAgent||"").toLowerCase(),o=-1!==n.indexOf("msie 6");j.pin=function(a,b){a=c(a),b=c(b);var e=l(a.element);"fixed"!==e.css("position")||o?(e.css("position","absolute"),m=!1):m=!0,d(a),d(b);var g=f(e),h=b.offset(),i=h.top+b.y-a.y-g.top,j=h.left+b.x-a.x-g.left;e.css({left:j,top:i})},j.center=function(a,b){j.pin({element:a,x:"50%",y:"50%"},{element:b,x:"50%",y:"50%"})},j.VIEWPORT=k});

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。