Skip to main content

Bug Tracker

Side navigation

Ticket #2171: containmentwindow.patch


File containmentwindow.patch, 0.8 KB (added by scottgonzalez, January 15, 2008 10:33PM UTC)
Index: ui.draggable.ext.js
===================================================================
--- ui.draggable.ext.js	(revision 4457)
+++ ui.draggable.ext.js	(working copy)
@@ -90,6 +90,15 @@
 					$(document).width(),
 					($(document).height() || document.body.parentNode.scrollHeight)
 				];
+			} else if(o._containment == 'window' || o._containment == window) {
+				var leftAdjust = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);
+				var topAdjust = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
+				o.containment = [
+					leftAdjust,
+					topAdjust,
+					$(window).width() + leftAdjust,
+					$(window).height() + topAdjust
+				];
 			} else { //I'm a node, so compute top/left/right/bottom
 
 				var ce = $(o._containment)[0];

Download in other formats:

Original Format