Position: Changed document/window detection to be consistent with jQuery core.

Fixes a bug in IE7/8 where window == document.
This commit is contained in:
Scott González 2009-11-19 16:37:05 +00:00
parent 17829ce546
commit 3cc921dd3d

View File

@ -29,11 +29,11 @@ $.fn.position = function(options) {
targetHeight,
basePosition;
if (options.of == document) {
if (options.of.nodeType === 9) {
targetWidth = target.width();
targetHeight = target.height();
basePosition = { top: 0, left: 0 };
} else if (options.of == window) {
} else if ('scrollTo' in options.of && options.of.document) {
targetWidth = target.width();
targetHeight = target.height();
basePosition = { top: target.scrollTop(), left: target.scrollLeft() };