Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The website seems to use jQuery <a href="http://api.jquery.com/animate/" rel="nofollow"><code>animate()</code></a>, although in a roundabout way.</p> <p>From the page source:</p> <pre><code>&lt;a href="javascript:animatedcollapse.toggle('ahmedabad')"&gt;Ahmedabad&lt;/a&gt; </code></pre> <p>If you check <code>animatedcollapse.js</code>, you will see the <code>toggle()</code> function:</p> <pre><code>toggle:function(divid){ //public method if (typeof divid=="object") divid=divid[0] this.showhide(divid, "toggle") } </code></pre> <p>The <code>toggle()</code> function uses <code>showhide()</code>:</p> <pre><code>showhide:function(divid, action){ var $divref=this.divholders[divid].$divref //reference collapsible DIV if (this.divholders[divid] &amp;&amp; $divref.length==1){ //if DIV exists var targetgroup=this.divgroups[$divref.attr('groupname')] //find out which group DIV belongs to (if any) if ($divref.attr('groupname') &amp;&amp; targetgroup.count&gt;1 &amp;&amp; (action=="show" || action=="toggle" &amp;&amp; $divref.css('display')=='none')){ //If current DIV belongs to a group if (targetgroup.lastactivedivid &amp;&amp; targetgroup.lastactivedivid!=divid) //if last active DIV is set this.slideengine(targetgroup.lastactivedivid, 'hide') //hide last active DIV within group first this.slideengine(divid, 'show') targetgroup.lastactivedivid=divid //remember last active DIV } else{ this.slideengine(divid, action) } } } </code></pre> <p><code>showhide()</code> in turn uses <code>slideengine()</code>:</p> <pre><code>slideengine:function(divid, action){ var $divref=this.divholders[divid].$divref if (this.divholders[divid] &amp;&amp; $divref.length==1){ //if this DIV exists var animateSetting={height: action} if ($divref.attr('fade')) animateSetting.opacity=action $divref.animate(animateSetting, $divref.attr('speed')? parseInt($divref.attr('speed')) : 500) return false } } </code></pre> <p>We can see that <code>$divref</code> from <code>slideengine()</code> is actually a jQuery object from the following line in <code>init()</code>:</p> <pre><code>this.$divref=$('#'+this.id) </code></pre> <p>Thus, we can conclude that the website uses jQuery <code>animate()</code>:</p> <p><a href="http://api.jquery.com/animate/" rel="nofollow">http://api.jquery.com/animate/</a></p> <p>Normally it would not be this easy to find out what exactly is going on, as websites do not tend to provide non-minified and commented versions of its code...</p> <p>Note: If I am not supposed to post the above code, then someone please let me know.</p> <p><strong>Edit:</strong></p> <p>As mentioned by others, you can use jQuery UI's <a href="http://jqueryui.com/demos/accordion/" rel="nofollow"><code>accordion</code></a>. Another option would be to use jQuery's <a href="http://api.jquery.com/slideToggle/" rel="nofollow"><code>slideToggle()</code></a>.</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.
 

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