Skip to content

Commit 3d5d58d

Browse files
committed
Merge pull request jquery#187 from virgofx/master.
Fix #7270 - Draggable iFrameFix
2 parents 4f63e5c + b1c8a13 commit 3d5d58d

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")) {
@@ -630,24 +650,6 @@ $.ui.plugin.add("draggable", "cursor", {
630650
}
631651
});
632652

633-
$.ui.plugin.add("draggable", "iframeFix", {
634-
start: function(event, ui) {
635-
var o = $(this).data('draggable').options;
636-
$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
637-
$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
638-
.css({
639-
width: this.offsetWidth+"px", height: this.offsetHeight+"px",
640-
position: "absolute", opacity: "0.001", zIndex: 1000
641-
})
642-
.css($(this).offset())
643-
.appendTo("body");
644-
});
645-
},
646-
stop: function(event, ui) {
647-
$("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
648-
}
649-
});
650-
651653
$.ui.plugin.add("draggable", "opacity", {
652654
start: function(event, ui) {
653655
var t = $(ui.helper), o = $(this).data('draggable').options;

0 commit comments

Comments
 (0)