Note that there are some explanatory texts on larger screens.

plurals
  1. POSlide Hiding a div with jQuery UI. How do I slide its adjacent div right along with it to take its place?
    primarykey
    data
    text
    <p>Happy New Year!</p> <p>I have a div that I would like to slide in and out of view with a button click. I would like its adjacent div to slide seamlessly alongside it to take it's place. At the moment the adjacent div does not move until the sliding animation is finished and then it jumps into the hidden div's place in one clunky motion.</p> <p>How can I get them to slide together and hide one but not the other?</p> <p>Right now I'm using jQuery UI, but maybe I should be using .animate()?</p> <p>You'll get the best idea of what I'm trying to do here: <a href="http://www.redearthtrail.com/img/sampleapi5.php" rel="nofollow">http://www.redearthtrail.com/img/sampleapi5.php</a></p> <p><a href="http://jsfiddle.net/GUjPA/" rel="nofollow">Here's a jsFiddle</a> to demonstrate as well:</p> <p><strong>JS</strong></p> <pre><code>var state = false; $("#toggle-slide-button").click(function () { if (!state) { $('#map-legend').hide("slide", { direction: "right"}, 1000); $('#toggle-slide-button img').attr('src', '/img/map-arrow-open.png'); state = true; } else { $('#map-legend').show("slide", { direction: "right"}, 1000); $('#toggle-slide-button img').attr('src', '/img/map-arrow-close.png'); state = false; } }); </code></pre> <p><strong>CSS</strong></p> <pre><code>#map-legend-control { width: 50px; height: 100%; margin: 0; padding: 0 20px; float: right; background-color: #000; position: relative; } #map-legend { width: 400px; height: 100%; margin: 0; padding: 0; float: right; position: relative; background-color: #CCC; -webkit-box-shadow:inset 1px 0 5px 0 rgba(000,000,00,1); box-shadow:inset 1px 0 5px 0 rgba(000,000,00,1); } #map-legend p { padding-left: 25px; } </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;div id="map-legend"&gt; &lt;p&gt;&lt;strong&gt;Trail Name:&lt;/strong&gt;&lt;/p&gt; &lt;p id="trail-id"&gt;Please select a trail.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Trail Difficulty:&lt;/strong&gt;&lt;/p&gt; &lt;p id="trail-difficulty"&gt;Please select a trail.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Trail Latitude:&lt;/strong&gt;&lt;/p&gt; &lt;p id="trail-lat"&gt;Please select a trail.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Trail Longitude:&lt;/strong&gt;&lt;/p&gt; &lt;p id="trail-long"&gt;Please select a trail.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Trail Thumbnail:&lt;/strong&gt;&lt;/p&gt; &lt;p id="trail-thumb"&gt;Please select a trail.&lt;/p&gt; &lt;div style="position:absolute;bottom:0;"&gt; &lt;p&gt;&lt;strong&gt;Trail Sponsor:&lt;/strong&gt;&lt;/p&gt; &lt;p id="trail-sponsor"&gt;Please select a trail.&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="map-legend-control"&gt; &lt;a href="#" id="toggle-slide-button"&gt;&lt;img src="http://www.redearthtrail.com/img/map-arrow-close.png" width="50px" height="50px" /&gt;&lt;/a&gt; &lt;/div&gt; </code></pre> <p>Thanks for any insight!</p>
    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.
    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. 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