Note that there are some explanatory texts on larger screens.

plurals
  1. POAccordion animate Jquery
    text
    copied!<p>Hello I would want that #accordion if it is opened eliminates the margin of 200px, if it is closed inserts the margin of 200px. I have connected elimination of the margin to the function on click h3, when it is opened. How I make to insert the margin when #accordion is closed?</p> <p>Link temporany page:<a href="http://www.davidxdesign.altervista.org/city.htm" rel="nofollow">http://www.davidxdesign.altervista.org/city.htm</a></p> <pre><code>&lt;script&gt; $(function() { var stop = false; $("#accordion h3").click(function( event ){ if ( stop ) { event.stopImmediatePropagation(); event.preventDefault(); stop = false } }); $("#accordion").accordion({ header: "&gt; div &gt; h3", collapsible: true, active: false, autoHeight: false, changestart: function(event, ui){ ui.newHeader.parent().prependTo(this); } }) .sortable({ axis: "y", handle: "h3", stop: function() { stop = true; } }) }); &lt;/script&gt; &lt;script&gt; function zeromargindiv(){ $('#accordion').animate({ marginTop: '0px' }, 2000, function() { }); } &lt;/script&gt;** &lt;div id="accordion" style="margin-top:180px"&gt; &lt;div class="group"&gt; &lt;h3 onclick="zeromargindiv()"&gt;Cosa Visitare&lt;/h3&gt; &lt;div&gt; &lt;/br&gt; &lt;a onclick="go('map/duomo.htm')"&gt;Via del Duomo&lt;/a&gt; &lt;/br&gt; &lt;a onclick="go('map/cavour.htm')"&gt;Corso Cavour&lt;/a&gt; &lt;/br&gt; &lt;a onclick="go('map/palcapitano.htm')"&gt;Palazzo del Capitano del Popolo&lt;/a&gt; &lt;/br&gt; &lt;a &gt;Palazzo Comunale&lt;/a&gt; &lt;/br&gt; &lt;a &gt;Vicolo degli Artisti&lt;/a&gt; &lt;/br&gt; &lt;a href="http://www.baduel.it" target="_blank" &gt;Libreria antiquaria Baduel&lt;/a&gt; &lt;/br&gt; &lt;a href="http://www.bibliotecaorvieto.it/easyne2/LYT.aspx?IDLYT=8892&amp;ST=SQL&amp;SQL=ID_Documento=30&amp;CODE=FUMI" target="_blank" &gt;Biblioteca Fiumi&lt;/a&gt; &lt;/br&gt;&lt;/br&gt; &lt;/div&gt; &lt;/div&gt; etc... </code></pre>
 

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