Commit 3e3b86c7 authored by Brandon Aaron's avatar Brandon Aaron

Getting the width and height of the document now returns the correct value in...

Getting the width and height of the document now returns the correct value in all browsers. It even works around the scrollWidth == offsetWidth bug in Firefox thanks to wizzud.
parent e1af5faf
...@@ -1311,8 +1311,11 @@ jQuery.each([ "Height", "Width" ], function(i, name){ ...@@ -1311,8 +1311,11 @@ jQuery.each([ "Height", "Width" ], function(i, name){
// Get document width or height // Get document width or height
this[0] == document ? this[0] == document ?
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater (Mozilla reports scrollWidth the same as offsetWidth) // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
Math.max( document.body[ "scroll" + name ], document.body[ "offset" + name ] ) : Math.max(
Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
Math.max(document.body["offset" + name], document.documentElement["offset" + name])
) :
// Get or set width or height on the element // Get or set width or height on the element
size == undefined ? size == undefined ?
......
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