aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.draggable.js
diff options
context:
space:
mode:
authorBrian Grinstead <briangrinstead@gmail.com>2010-06-14 08:20:03 -0700
committerMike Sherov <mike.sherov@gmail.com>2013-05-20 22:10:04 -0400
commit24756a978a977d7abbef5e5bce403837a01d964f (patch)
tree59b473b02fc600d054a3b47ade5b0819f701bd76 /ui/jquery.ui.draggable.js
parent433ef9d433e9baa464cd0b313b82efa6f1d65556 (diff)
downloadjquery-ui-24756a978a977d7abbef5e5bce403837a01d964f.tar.gz
jquery-ui-24756a978a977d7abbef5e5bce403837a01d964f.zip
Draggable: enabled draggable from within iframe. Fixed #5727 - draggable: cannot drag element inside iframe
Diffstat (limited to 'ui/jquery.ui.draggable.js')
-rw-r--r--ui/jquery.ui.draggable.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js
index 45b724fde..bf90d349b 100644
--- a/ui/jquery.ui.draggable.js
+++ b/ui/jquery.ui.draggable.js
@@ -325,7 +325,8 @@ $.widget("ui.draggable", $.ui.mouse, {
_getParentOffset: function() {
//Get the offsetParent and cache its position
- var po = this.offsetParent.offset();
+ var po = this.offsetParent.offset(),
+ document = this.document[ 0 ];
// This is a special case where we need to modify a offset calculated on start, since the following happened:
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
@@ -383,7 +384,8 @@ $.widget("ui.draggable", $.ui.mouse, {
_setContainment: function() {
var over, c, ce,
- o = this.options;
+ o = this.options,
+ document = this.document[ 0 ];
if ( !o.containment ) {
this.containment = null;
@@ -444,6 +446,7 @@ $.widget("ui.draggable", $.ui.mouse, {
}
var mod = d === "absolute" ? 1 : -1,
+ document = this.document[ 0 ],
scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent;
//Cache the scroll
@@ -472,6 +475,7 @@ $.widget("ui.draggable", $.ui.mouse, {
var containment, co, top, left,
o = this.options,
+ document = this.document[ 0 ],
scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent,
pageX = event.pageX,
pageY = event.pageY;
@@ -778,17 +782,17 @@ $.ui.plugin.add("draggable", "opacity", {
$.ui.plugin.add("draggable", "scroll", {
start: function( event, ui, i ) {
- if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") {
+ if( i.scrollParent[ 0 ] !== i.document[ 0 ] && i.scrollParent[ 0 ].tagName !== "HTML" ) {
i.overflowOffset = i.scrollParent.offset();
}
},
drag: function( event, ui, i ) {
var o = i.options,
- scrolled = false;
-
- if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") {
+ scrolled = false,
+ document = i.document[ 0 ];
+ if( i.scrollParent[ 0 ] !== document && i.scrollParent[ 0 ].tagName !== "HTML" ) {
if(!o.axis || o.axis !== "x") {
if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;