mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-10-05 01:44:18 +00:00
Merge pull request #187 from virgofx/master.
Fix #7270 - Draggable iFrameFix
This commit is contained in:
commit
3d5d58d854
38
ui/jquery.ui.draggable.js
vendored
38
ui/jquery.ui.draggable.js
vendored
@ -80,6 +80,16 @@ $.widget("ui.draggable", $.ui.mouse, {
|
||||
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;
|
||||
|
||||
},
|
||||
@ -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")) {
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user