Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Are you going to allow more than one instance with your draggable objects? then use the helper and append option:</p> <pre><code>$(".tag_cell").draggable({ helper: 'clone', appendTo: 'div#myHelperHolder' }); </code></pre> <p>Then in your css you can set the zindex of div#myHelperHolder to be 999. If not, then try just using the zindex option:</p> <pre><code>$(".tag_cell").draggable({ zIndex: 999 }); </code></pre> <p>I would also consider setting addClasses to stop the plugin from adding all those annoying classes that waste processor speed.</p> <p><strong>UPDATE: I HAVE A NEW SOLUTION</strong></p> <p>Okay after playing with it for a bit I came up with this: the scroll option doesn't stop the child from being hidden with overflow. I've read some other posts and I cant find a single solution. But I came up with a bit of a work-a-round that gets the job done.</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;script type="text/javascript" src="http://www.google.com/jsapi"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; google.load("jquery", "1.4.0"); google.load("jqueryui", "1.7.2"); google.setOnLoadCallback(OnLoad); function OnLoad(){ var dropped = false; $(".tag_cell").draggable({ addClasses: false, revert: 'invalid', containment: '#tagFun_div_main', helper: 'clone', appendTo: '#tagFun_div_helper', start: function(event, ui) { dropped = false; $(this).addClass("hide"); }, stop: function(event, ui) { if (dropped==true) { $(this).remove(); } else { $(this).removeClass("hide"); } } }); $("#tf_dropBox").droppable({ accept: '.tag_cell', hoverClass: 'tf_dropBox_hover', activeClass: 'tf_dropBox_active', drop: function(event, ui) { dropped = true; $.ui.ddmanager.current.cancelHelperRemoval = true; ui.helper.appendTo(this); } }); } &lt;/script&gt; &lt;style&gt; div#tagFun_div_main { display:block; width:800px; height:400px; margin:auto; padding:10px; background:#F00; } div#tf_div_tagsReturn { display:block; width:200px; height:100%; float:left; overflow:auto; background:#000; } div#tf_div_tagsDrop { display:block; width:200px; height:100%; float:right; background:#0F0; } div#tf_dropBox { display:block; width:100%; height:250px; background:#F0F; } span.tag_cell { display:block; width:25px; height:25px; margin:1px; float:left; cursor:pointer; background:#0FF; z-index:99; } span.tag_cell.hide { display:none; } div#tf_dropBox.tf_dropBox_hover { background:#FFF !important; } div#tf_dropBox.tf_dropBox_active { background:#333; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="tagFun_div_main"&gt; &lt;div id="tf_div_tagsReturn"&gt; &lt;span class="tag_cell"&gt;&lt;/span&gt; &lt;span class="tag_cell"&gt;&lt;/span&gt; &lt;span class="tag_cell"&gt;&lt;/span&gt; &lt;span class="tag_cell"&gt;&lt;/span&gt; &lt;span class="tag_cell"&gt;&lt;/span&gt; &lt;span class="tag_cell"&gt;&lt;/span&gt; &lt;span class="tag_cell"&gt;&lt;/span&gt; &lt;span class="tag_cell"&gt;&lt;/span&gt; &lt;span class="tag_cell"&gt;&lt;/span&gt; &lt;span class="tag_cell"&gt;&lt;/span&gt; &lt;span class="tag_cell"&gt;&lt;/span&gt; &lt;/div&gt; &lt;div id="tf_div_tagsDrop"&gt; &lt;div id="tf_dropBox"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="tagFun_div_helper"&gt; &lt;!-- this is where the helper gets appended for temporary use --&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I pasted my entire code so you can try it out. Here is a brief description: When you start to drag an item it hides the original, clones it, then appends the clone to a container outside the overflow area. Once dropped it removes the original and moves the clone into the drop zone. Great so now we have fixed that overflow issue but run into some others. When you drop the clone item into the drop zone it disappears. To stop that from happening I used this method:</p> <pre><code>$.ui.ddmanager.current.cancelHelperRemoval = true; </code></pre> <p>Now we have stopped the helper from being removed but it remains in "div#tagFun_div_helper" while the original draggable item has reappeared.</p> <pre><code>ui.helper.appendTo(this); </code></pre> <p>This will transfer the helper from "div#tagFun_div_helper" into our drop zone.</p> <pre><code>dropped = true; </code></pre> <p>This will tell our stop function to delete the original item from the group instead of removing the ".hide" class. Hope that helps!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload