-
Notifications
You must be signed in to change notification settings - Fork 2
/
jquery.position-enhanced.min.js
9 lines (8 loc) · 1.48 KB
/
jquery.position-enhanced.min.js
1
2
3
4
5
6
7
8
9
/*************************************************
jquery.position-enhanced plugin v0.11
Author: www.benbarnett.net || @benpbarnett
Copyright (c) 2011 Ben Barnett
Licensed under the MIT license
http://www.opensource.org/licenses/mit-license.php
**************************************************/
(function(j,c,e){var b=["","-webkit-","-moz-","-o-"];var g=document.body||document.documentElement,f=g.style,a=(f.WebkitTransition!==undefined)?"webkitTransitionEnd":(f.OTransition!==undefined)?"oTransitionEnd":"transitionend",d=f.WebkitTransition!==undefined||f.MozTransition!==undefined||f.OTransition!==undefined||f.transition!==undefined,i=use3DByDefault=("WebKitCSSMatrix" in window&&"m11" in new WebKitCSSMatrix());function h(){if(!this[0]){return null}var o=this[0],l=window.getComputedStyle(o,null),p={left:0,top:0};for(var n=b.length-1;n>=0;n--){var m=l.getPropertyValue(b[n]+"transform");if(m&&(/matrix/i).test(m)){var k=m.replace(/^matrix\(/i,"").split(/, |\)$/g);p={left:parseInt(k[4],10),top:parseInt(k[5],10)};break}}return p}j.fn.position=function(){if(!this[0]){return null}if(!d||f.WebkitTransition!==undefined){return c.apply(this,arguments)}var k=c.apply(this,arguments),l=h.call(this);return(k)?{left:k.left+l.left,top:k.top+l.top}:null};j.fn.offset=function(){if(!this[0]){return null}if(!d||f.WebkitTransition!==undefined){return e.apply(this,arguments)}var k=e.apply(this,arguments),l=h.call(this);return(k)?{left:k.left+l.left,top:k.top+l.top}:null}})(jQuery,jQuery.fn.position,jQuery.fn.offset);