]> source.dussan.org Git - jquery-ui.git/commitdiff
Draggable: Modified the iframe shims to load prior to dragging. Fixed #7270.
authorMark Johnson <virgofx@live.com>
Tue, 19 Apr 2011 21:39:58 +0000 (14:39 -0700)
committerScott González <scott.gonzalez@gmail.com>
Mon, 2 May 2011 21:49:38 +0000 (17:49 -0400)
(cherry picked from commit b1c8a13a1669dca4c4bde97fe2cc8b76f661b432)

ui/jquery.ui.draggable.js

index 8958e49cfffbe8858ddcd68bdb29109f6c2308ab..cf08e47983f69eb72b5c6c1a87bb1eae6afa2d8a 100644 (file)
@@ -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;
 
@@ -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;