Commit 2d4755a0 authored by Ariel Flesler's avatar Ariel Flesler

jquery dimensions: removed redundant code

parent ece001f1
...@@ -3,24 +3,22 @@ jQuery.each([ "Height", "Width" ], function(i, name){ ...@@ -3,24 +3,22 @@ jQuery.each([ "Height", "Width" ], function(i, name){
var tl = i ? "Left" : "Top", // top or left var tl = i ? "Left" : "Top", // top or left
br = i ? "Right" : "Bottom", // bottom or right br = i ? "Right" : "Bottom", // bottom or right
lower = name.toLowerCase(); type = name.toLowerCase();
// innerHeight and innerWidth // innerHeight and innerWidth
jQuery.fn["inner" + name] = function(){ jQuery.fn["inner" + name] = function(){
return this[0] ? return this[0] ?
jQuery.css( this[0], lower, false, "padding" ) : jQuery.css( this[0], type, false, "padding" ) :
null; null;
}; };
// outerHeight and outerWidth // outerHeight and outerWidth
jQuery.fn["outer" + name] = function(margin) { jQuery.fn["outer" + name] = function(margin) {
return this[0] ? return this[0] ?
jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) : jQuery.css( this[0], type, false, margin ? "margin" : "border" ) :
null; null;
}; };
var type = name.toLowerCase();
jQuery.fn[ type ] = function( size ) { jQuery.fn[ type ] = function( size ) {
// Get window width or height // Get window width or height
return this[0] == window ? return this[0] == window ?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment