Note that there are some explanatory texts on larger screens.

plurals
  1. POBlock draggable element from appearing after another
    primarykey
    data
    text
    <p>I have two draggable elements on the same x axis. I want to reproduce a slider effect, I mean slider 1 can't go after slider 2.</p> <p>I don't know how to do that. Can anyone help me?</p> <p>I use jQuery and the draggable plugin from jQuery UI.</p> <p>EDIT : </p> <p>Code : HTML : </p> <pre><code>&lt;div id="chrono-bar"&gt; &lt;div id="slider-left" class="slider-left draggable obstacle"&gt;&lt;/div&gt; &lt;div id="slider-right" class="slider-right draggable"&gt;&lt;/div&gt; &lt;ul class="chrono-bar-ul block"&gt; &lt;li class="chrono-bar-item"&gt;Janvier&lt;/li&gt; &lt;li class="chrono-bar-item"&gt;Février&lt;/li&gt; &lt;li class="chrono-bar-item"&gt;Mars&lt;/li&gt; &lt;li class="chrono-bar-item"&gt;Avril&lt;/li&gt; &lt;li class="chrono-bar-item"&gt;Mai&lt;/li&gt; &lt;li class="chrono-bar-item"&gt;Juin&lt;/li&gt; &lt;li class="chrono-bar-item"&gt;Juillet&lt;/li&gt; &lt;li class="chrono-bar-item"&gt;Aout&lt;/li&gt; &lt;li class="chrono-bar-item"&gt;Septembre&lt;/li&gt; &lt;li class="chrono-bar-item"&gt;Octobre&lt;/li&gt; &lt;li class="chrono-bar-item"&gt;Novembre&lt;/li&gt; &lt;li class="chrono-bar-item last"&gt;Décembre&lt;/li&gt; &lt;/ul&gt; &lt;div class="chrono-bar-footer"&gt; &lt;div class="line"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p> Javascript : </p> <pre><code>&lt;script&gt; $("#slider-left").draggable({ axis: 'x', containment: 'parent', 'snap': '#slider-right', collide: 'block', drag: function() { console.log($('#slider-left').offset().left); } }); $("#slider-right").draggable({ axis: 'x', containment: 'parent','snap': '#slider-left' }); </code></pre> <p></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.
 

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