Skip to content

Commit

Permalink
Merge pull request #187 from virgofx/master.
Browse files Browse the repository at this point in the history
Fix #7270 - Draggable iFrameFix
  • Loading branch information
scottgonzalez committed May 2, 2011
2 parents 4f63e5c + b1c8a13 commit 3d5d58d
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions ui/jquery.ui.draggable.js
Expand Up @@ -79,6 +79,16 @@ $.widget("ui.draggable", $.ui.mouse, {
this.handle = this._getHandle(event);
if (!this.handle)
return false;

$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
.css({
width: this.offsetWidth+"px", height: this.offsetHeight+"px",
position: "absolute", opacity: "0.001", zIndex: 1000
})
.css($(this).offset())
.appendTo("body");
});

return true;

Expand Down Expand Up @@ -212,6 +222,16 @@ $.widget("ui.draggable", $.ui.mouse, {
return false;
},

_mouseUp: function(event) {
if (this.options.iframeFix === true) {
$("div.ui-draggable-iframeFix").each(function() {
this.parentNode.removeChild(this);
}); //Remove frame helpers
}

return $.ui.mouse.prototype._mouseUp.call(this, event);
},

cancel: function() {

if(this.helper.is(".ui-draggable-dragging")) {
Expand Down Expand Up @@ -630,24 +650,6 @@ $.ui.plugin.add("draggable", "cursor", {
}
});

$.ui.plugin.add("draggable", "iframeFix", {
start: function(event, ui) {
var o = $(this).data('draggable').options;
$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
.css({
width: this.offsetWidth+"px", height: this.offsetHeight+"px",
position: "absolute", opacity: "0.001", zIndex: 1000
})
.css($(this).offset())
.appendTo("body");
});
},
stop: function(event, ui) {
$("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
}
});

$.ui.plugin.add("draggable", "opacity", {
start: function(event, ui) {
var t = $(ui.helper), o = $(this).data('draggable').options;
Expand Down

0 comments on commit 3d5d58d

Please sign in to comment.