vtenext/include/js/jquery_plugins/dimensions.min.js
2021-04-28 20:10:26 +02:00

13 lines
1.9 KiB
JavaScript

/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* $LastChangedDate: 2007-12-20 08:43:48 -0600 (Thu, 20 Dec 2007) $
* $Rev: 4257 $
*
* Version: 1.2
*
* Requires: jQuery 1.2+
*/
// crmv@82419 - replace curCSS with css
!function(a){function b(b,c){return parseInt(a.css(b.jquery?b[0]:b,c,!0))||0}a.dimensions={version:"1.2"},a.each(["Height","Width"],function(c,d){a.fn["inner"+d]=function(){if(this[0]){var a="Height"==d?"Top":"Left",c="Height"==d?"Bottom":"Right";return this.is(":visible")?this[0]["client"+d]:b(this,d.toLowerCase())+b(this,"padding"+a)+b(this,"padding"+c)}},a.fn["outer"+d]=function(c){if(this[0]){var e="Height"==d?"Top":"Left",f="Height"==d?"Bottom":"Right";c=a.extend({margin:!1},c||{});var g=this.is(":visible")?this[0]["offset"+d]:b(this,d.toLowerCase())+b(this,"border"+e+"Width")+b(this,"border"+f+"Width")+b(this,"padding"+e)+b(this,"padding"+f);return g+(c.margin?b(this,"margin"+e)+b(this,"margin"+f):0)}}}),a.each(["Left","Top"],function(b,c){a.fn["scroll"+c]=function(b){if(this[0])return void 0!=b?this.each(function(){this==window||this==document?window.scrollTo("Left"==c?b:a(window).scrollLeft(),"Top"==c?b:a(window).scrollTop()):this["scroll"+c]=b}):this[0]==window||this[0]==document?self["Left"==c?"pageXOffset":"pageYOffset"]||a.boxModel&&document.documentElement["scroll"+c]||document.body["scroll"+c]:this[0]["scroll"+c]}}),a.fn.extend({position:function(){var e,f,g,h,d=this[0];return d&&(g=this.offsetParent(),e=this.offset(),f=g.offset(),e.top-=b(d,"marginTop"),e.left-=b(d,"marginLeft"),f.top+=b(g,"borderTopWidth"),f.left+=b(g,"borderLeftWidth"),h={top:e.top-f.top,left:e.left-f.left}),h}})}(jQuery);