* If used on window, returns the viewport's (window) height\r
*\r
* @example $("#testdiv").height()\r
- * @result "200px"
- *
- * @example $(document).height();
- * @result 800
- *
- * @example $(window).height();
+ * @result "200px"\r
+ *\r
+ * @example $(document).height();\r
+ * @result 800\r
+ *\r
+ * @example $(window).height();\r
* @result 400\r
* \r
* @name height\r
* @type Object\r
* @cat Dimensions\r
*/\r
-$.fn.height = function() {\r
- if ( this.get(0) == window )
- return self.innerHeight ||
+jQuery.fn.height = function() {\r
+ if ( this.get(0) == window )\r
+ return self.innerHeight ||\r
jQuery.boxModel && document.documentElement.clientHeight ||\r
document.body.clientHeight;\r
\r
return Math.max( document.body.scrollHeight, document.body.offsetHeight );\r
\r
return this.css("height");\r
-};
+};\r
\r
/**\r
* Returns the css width value for the first matched element.\r
* If used on window, returns the viewport's (window) width\r
*\r
* @example $("#testdiv").width()\r
- * @result "200px"
- *
- * @example $(document).width();
- * @result 800
- *
- * @example $(window).width();
+ * @result "200px"\r
+ *\r
+ * @example $(document).width();\r
+ * @result 800\r
+ *\r
+ * @example $(window).width();\r
* @result 400\r
* \r
* @name width\r
* @type Object\r
* @cat Dimensions\r
*/\r
-$.fn.width = function() {\r
- if ( this.get(0) == window )
- return self.innerWidth ||
+jQuery.fn.width = function() {\r
+ if ( this.get(0) == window )\r
+ return self.innerWidth ||\r
jQuery.boxModel && document.documentElement.clientWidth ||\r
document.body.clientWidth;\r
\r
return Math.max( document.body.scrollWidth, document.body.offsetWidth );\r
\r
return this.css("width");\r
-};
+};\r
\r
/**\r
* Returns the inner height value (without border) for the first matched element.\r
* @type Number\r
* @cat Dimensions\r
*/\r
-$.fn.innerHeight = function() {\r
- return this.get(0) == window || this.get(0) == document ?
- this.height() :
+jQuery.fn.innerHeight = function() {\r
+ return this.get(0) == window || this.get(0) == document ?\r
+ this.height() :\r
this.get(0).offsetHeight - parseInt(this.css("borderTop") || 0) - parseInt(this.css("borderBottom") || 0);\r
-};
+};\r
\r
/**\r
* Returns the inner width value (without border) for the first matched element.\r
* @type Number\r
* @cat Dimensions\r
*/\r
-$.fn.innerWidth = function() {\r
- return this.get(0) == window || this.get(0) == document ?
- this.width() :
+jQuery.fn.innerWidth = function() {\r
+ return this.get(0) == window || this.get(0) == document ?\r
+ this.width() :\r
this.get(0).offsetWidth - parseInt(this.css("borderLeft") || 0) - parseInt(this.css("borderRight") || 0);\r
-};
+};\r
\r
/**\r
* Returns the outer height value (including border) for the first matched element.\r
* @type Number\r
* @cat Dimensions\r
*/\r
-$.fn.outerHeight = function() {\r
- return this.get(0) == window || this.get(0) == document ?
- this.height() :
+jQuery.fn.outerHeight = function() {\r
+ return this.get(0) == window || this.get(0) == document ?\r
+ this.height() :\r
this.get(0).offsetHeight; \r
-};
+};\r
\r
/**\r
* Returns the outer width value (including border) for the first matched element.\r
* @type Number\r
* @cat Dimensions\r
*/\r
-$.fn.outerWidth = function() {\r
- return this.get(0) == window || this.get(0) == document ?
- this.width() :
+jQuery.fn.outerWidth = function() {\r
+ return this.get(0) == window || this.get(0) == document ?\r
+ this.width() :\r
this.get(0).offsetWidth; \r
-};
+};\r
\r
/**\r
* Returns how many pixels the user has scrolled to the right (scrollLeft).\r
* @type Number\r
* @cat Dimensions\r
*/\r
-$.fn.scrollLeft = function() {\r
- if ( this.get(0) == window || this.get(0) == document )
- return self.pageXOffset ||
- jQuery.boxModel && document.documentElement.scrollLeft ||
- document.body.scrollLeft;
+jQuery.fn.scrollLeft = function() {\r
+ if ( this.get(0) == window || this.get(0) == document )\r
+ return self.pageXOffset ||\r
+ jQuery.boxModel && document.documentElement.scrollLeft ||\r
+ document.body.scrollLeft;\r
\r
return this.get(0).scrollLeft;\r
-};
+};\r
\r
/**\r
* Returns how many pixels the user has scrolled to the bottom (scrollTop).\r
* @type Number\r
* @cat Dimensions\r
*/\r
-$.fn.scrollTop = function() {\r
- if ( this.get(0) == window || this.get(0) == document )
- return self.pageYOffset ||
- jQuery.boxModel && document.documentElement.scrollTop ||
- document.body.scrollTop;
+jQuery.fn.scrollTop = function() {\r
+ if ( this.get(0) == window || this.get(0) == document )\r
+ return self.pageYOffset ||\r
+ jQuery.boxModel && document.documentElement.scrollTop ||\r
+ document.body.scrollTop;\r
\r
return this.get(0).scrollTop;\r
};\r
\r
-/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)\r
- * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) \r
- * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.\r
- */\r
-\r
/**\r
* This returns an object with top, left, width, height, borderLeft,\r
* borderTop, marginLeft, marginTop, scrollLeft, scrollTop, \r
* @cat Dimensions\r
* @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)\r
*/\r
-$.fn.offset = function(refElem) {\r
- if (!this[0]) throw '$.fn.offset requires an element.';\r
+jQuery.fn.offset = function(refElem) {\r
+ if (!this[0]) throw 'jQuery.fn.offset requires an element.';\r
\r
- refElem = (refElem) ? $(refElem)[0] : null;\r
+ refElem = (refElem) ? jQuery(refElem)[0] : null;\r
var x = 0, y = 0, elm = this[0], parent = this[0], pos = null, borders = [0,0], isElm = true, sl = 0, st = 0;\r
do {\r
if (parent.tagName == 'BODY' || parent.tagName == 'HTML') {\r
// Safari and IE don't add margin for static and relative\r
- if (($.browser.safari || $.browser.msie) && pos != 'absolute') {\r
- x += parseInt($.css(parent, 'marginLeft')) || 0;\r
- y += parseInt($.css(parent, 'marginTop')) || 0;\r
+ if ((jQuery.browser.safari || jQuery.browser.msie) && pos != 'absolute') {\r
+ x += parseInt(jQuery.css(parent, 'marginLeft')) || 0;\r
+ y += parseInt(jQuery.css(parent, 'marginTop')) || 0;\r
}\r
break;\r
}\r
\r
- pos = $.css(parent, 'position');\r
- border = [parseInt($.css(parent, 'borderLeftWidth')) || 0,\r
- parseInt($.css(parent, 'borderTopWidth')) || 0];\r
+ pos = jQuery.css(parent, 'position');\r
+ border = [parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0,\r
+ parseInt(jQuery.css(parent, 'borderTopWidth')) || 0];\r
sl = parent.scrollLeft;\r
st = parent.scrollTop;\r
\r
y += (parent.offsetTop || 0) + border[1] - st;\r
\r
// Safari and Opera include the border already for parents with position = absolute|relative\r
- if (($.browser.safari || $.browser.opera) && !isElm && (pos == 'absolute' || pos == 'relative')) {\r
+ if ((jQuery.browser.safari || jQuery.browser.opera) && !isElm && (pos == 'absolute' || pos == 'relative')) {\r
x -= border[0];\r
y -= border[1];\r
}\r
} while(parent);\r
\r
if (refElem) {\r
- var offset = $(refElem).offset();\r
+ var offset = jQuery(refElem).offset();\r
x = x - offset.left;\r
y = y - offset.top;\r
sl = sl - offset.scrollLeft;\r
left: x,\r
width: elm.offsetWidth,\r
height: elm.offsetHeight,\r
- borderTop: parseInt($.css(elm, 'borderTopWidth')) || 0,\r
- borderLeft: parseInt($.css(elm, 'borderLeftWidth')) || 0,\r
- marginTop: parseInt($.css(elm, 'marginTopWidth')) || 0,\r
- marginLeft: parseInt($.css(elm, 'marginLeftWidth')) || 0,\r
+ borderTop: parseInt(jQuery.css(elm, 'borderTopWidth')) || 0,\r
+ borderLeft: parseInt(jQuery.css(elm, 'borderLeftWidth')) || 0,\r
+ marginTop: parseInt(jQuery.css(elm, 'marginTopWidth')) || 0,\r
+ marginLeft: parseInt(jQuery.css(elm, 'marginLeftWidth')) || 0,\r
scrollTop: st,\r
scrollLeft: sl,\r
pageYOffset: window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0,\r
z.a = function(){\r
if ( options.step )\r
options.step.apply( elem, [ z.now ] );\r
-\r
- if ( prop == "opacity" ) {\r
- if (jQuery.browser.mozilla && z.now == 1) z.now = 0.9999;\r
- if (window.ActiveXObject)\r
- y.filter = "alpha(opacity=" + z.now*100 + ")";\r
- else\r
- y.opacity = z.now;\r
-\r
- // My hate for IE will never die\r
- } else if ( parseInt(z.now) )\r
+ \r
+ if ( prop == "opacity" )\r
+ jQuery.attr(y, "opacity", z.now); // Let attr handle opacity\r
+ else if ( parseInt(z.now) ) // My hate for IE will never die\r
y[prop] = parseInt(z.now) + "px";\r
\r
y.display = "block";\r
\r
// Remember where we started, so that we can go back to it later\r
z.el.orig[prop] = this.cur();\r
-\r
- z.custom( 0, z.el.orig[prop] );\r
+ \r
+ // Begin the animation\r
+ if (prop == "opacity")\r
+ z.custom(z.el.orig[prop], 1);\r
+ else\r
+ z.custom(0, z.el.orig[prop]);\r
\r
// Stupid IE, look what you made me do\r
if ( prop != "opacity" )\r
z.custom(z.el.orig[prop], 0);\r
};\r
\r
- // IE has trouble with opacity if it does not have layout\r
- if ( jQuery.browser.msie && !z.el.currentStyle.hasLayout )\r
- y.zoom = "1";\r
- \r
// Remember the overflow of the element\r
if ( !z.el.oldOverlay )\r
z.el.oldOverflow = jQuery.css( z.el, "overflow" );\r
// Reset the property, if the item has been hidden\r
if ( z.o.hide ) {\r
for ( var p in z.el.curAnim ) {\r
- y[ p ] = z.el.orig[p] + ( p == "opacity" ? "" : "px" );\r
+ if (p == "opacity" && jQuery.browser.msie)\r
+ jQuery.attr(y, p, z.el.orig[p]);\r
+ else\r
+ y[ p ] = z.el.orig[p] + "px";\r
\r
// set its height and/or width to auto\r
if ( p == 'height' || p == 'width' )\r
* @desc Creates a div element (and all of its contents) dynamically, \r
* and appends it to the element with the ID of body. Internally, an\r
* element is created and it's innerHTML property set to the given markup.\r
- * It is therefore both quite flexible and limited.
+ * It is therefore both quite flexible and limited. \r
*\r
* @name $\r
* @param String expr An expression to search with, or a string of HTML to create on the fly.\r
});\r
\r
return p == "height" ? oHeight : oWidth;\r
- } else if ( p == "opacity" && jQuery.browser.msie )\r
- return parseFloat( jQuery.curCSS(e,"filter").replace(/[^0-9.]/,"") ) || 1;\r
+ }\r
\r
return jQuery.curCSS( e, p );\r
},\r
\r
curCSS: function(elem, prop, force) {\r
var ret;\r
+ \r
+ if (prop == 'opacity' && jQuery.browser.msie)\r
+ return jQuery.attr(elem.style, 'opacity');\r
\r
if (!force && elem.style[prop]) {\r
\r
disabled: "disabled",\r
checked: "checked"\r
};\r
+ \r
+ // IE actually uses filters for opacity ... elem is actually elem.style\r
+ if (name == "opacity" && jQuery.browser.msie && value != undefined) {\r
+ // IE has trouble with opacity if it does not have layout\r
+ // Would prefer to check element.hasLayout first but don't have access to the element here\r
+ elem['zoom'] = 1; \r
+ if (value == 1) // Remove filter to avoid more IE weirdness\r
+ return elem["filter"] = elem["filter"].replace(/alpha\([^\)]*\)/gi,"");\r
+ else\r
+ return elem["filter"] = elem["filter"].replace(/alpha\([^\)]*\)/gi,"") + "alpha(opacity=" + value * 100 + ")";\r
+ } else if (name == "opacity" && jQuery.browser.msie) {\r
+ return elem["filter"] ? parseFloat( elem["filter"].match(/alpha\(opacity=(.*)\)/)[1] )/100 : 1;\r
+ }\r
+ \r
+ // Mozilla doesn't play well with opacity 1\r
+ if (name == "opacity" && jQuery.browser.mozilla && value == 1) value = 0.9999;\r
\r
if ( fix[name] ) {\r
if ( value != undefined ) elem[fix[name]] = value;\r