1 // Create innerHeight, innerWidth, outerHeight and outerWidth methods
2 jQuery.each([ "Height", "Width" ], function(i, name){
4 var tl = i ? "Left" : "Top", // top or left
5 br = i ? "Right" : "Bottom"; // bottom or right
7 // innerHeight and innerWidth
8 jQuery.fn["inner" + name] = function(){
9 return this[ name.toLowerCase() ]() +
10 num(this, "padding" + tl) +
11 num(this, "padding" + br);
14 // outerHeight and outerWidth
15 jQuery.fn["outer" + name] = function(margin) {
16 return this["inner" + name]() +
17 num(this, "border" + tl + "Width") +
18 num(this, "border" + br + "Width") +
20 num(this, "margin" + tl) + num(this, "margin" + br) : 0);