Skip to content

Commit b1c8a13

Browse files
committed
Draggable: Modified the iframe shims to load prior to dragging. Fixed #7270.
1 parent 5076f23 commit b1c8a13

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

ui/jquery.ui.draggable.js

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@ $.widget("ui.draggable", $.ui.mouse, {
7979
this.handle = this._getHandle(event);
8080
if (!this.handle)
8181
return false;
82+
83+
$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
84+
$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
85+
.css({
86+
width: this.offsetWidth+"px", height: this.offsetHeight+"px",
87+
position: "absolute", opacity: "0.001", zIndex: 1000
88+
})
89+
.css($(this).offset())
90+
.appendTo("body");
91+
});
8292

8393
return true;
8494

@@ -212,6 +222,16 @@ $.widget("ui.draggable", $.ui.mouse, {
212222
return false;
213223
},
214224

225+
_mouseUp: function(event) {
226+
if (this.options.iframeFix === true) {
227+
$("div.ui-draggable-iframeFix").each(function() {
228+
this.parentNode.removeChild(this);
229+
}); //Remove frame helpers
230+
}
231+
232+
return $.ui.mouse.prototype._mouseUp.call(this, event);
233+
},
234+
215235
cancel: function() {
216236

217237
if(this.helper.is(".ui-draggable-dragging")) {
@@ -616,24 +636,6 @@ $.ui.plugin.add("draggable", "cursor", {
616636
}
617637
});
618638

619-
$.ui.plugin.add("draggable", "iframeFix", {
620-
start: function(event, ui) {
621-
var o = $(this).data('draggable').options;
622-
$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
623-
$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
624-
.css({
625-
width: this.offsetWidth+"px", height: this.offsetHeight+"px",
626-
position: "absolute", opacity: "0.001", zIndex: 1000
627-
})
628-
.css($(this).offset())
629-
.appendTo("body");
630-
});
631-
},
632-
stop: function(event, ui) {
633-
$("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
634-
}
635-
});
636-
637639
$.ui.plugin.add("draggable", "opacity", {
638640
start: function(event, ui) {
639641
var t = $(ui.helper), o = $(this).data('draggable').options;

0 commit comments

Comments
 (0)