Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery ui draggable elements not 'draggable' outside of scrolling div
    primarykey
    data
    text
    <p>I have many elements (floating href tags) in a div with a set height/width, with scroll set to <code>overflow: auto</code> in the CSS.</p> <p>This is the structure of the divs:</p> <pre><code>&lt;div id="tagFun_div_main"&gt; &lt;div id="tf_div_tagsReturn"&gt; &lt;!-- all the draggable elements go in here, the parent div scolls --&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; </code></pre> <p>the parent div's, 'tf_div_tagsReturn' and 'tf_div_tagsDrop' will ultimately float next to each other.</p> <p>Here is the jQuery which is run after all of the 'draggable' elements have been created with class name 'tag_cell', :</p> <pre><code>$(function() { $(".tag_cell").draggable({ revert: 'invalid', scroll: false, containment: '#tagFun_div_main' }); $("#tf_dropBox").droppable({ accept: '.tag_cell', hoverClass: 'tf_dropBox_hover', activeClass: 'tf_dropBox_active', drop: function(event, ui) { GLOBAL_ary_tf_tags.push(ui.draggable.html()); tagFun_reload(); } }); }); </code></pre> <p>as I stated above, the draggable elements are draggable within div 'tf_div_tagsReturn', but they do not visually drag outside of that parent div. worthy to note, if I am dragging one of the draggable elements, and move the mouse over the droppable div, with id 'tf_dropBox', then the hoverclass is fired, I just can't see the draggable element any more.</p> <p>This is my first run at using jQuery, so hopefully I am just missing something super obvious. I've been reading the documentation and searching forums thus far to no prevail :(</p> <p><strong>UPDATE:</strong></p> <p>many thanks to Jabes88 for providing the solution which allowed me to achieve the functionality I was looking for. Here is what my jQuery ended up looking like:</p> <pre><code>$(function() { $(".tag_cell").draggable({ revert: 'invalid', scroll: false, containment: '#tagFun_div_main', helper: 'clone', start : function() { this.style.display="none"; }, stop: function() { this.style.display=""; } }); $(".tf_dropBox").droppable({ accept: '.tag_cell', hoverClass: 'tf_dropBox_hover', activeClass: 'tf_dropBox_active', drop: function(event, ui) { GLOBAL_ary_tf_tags.push(ui.draggable.html()); tagFun_reload(); } }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    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