Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>H, I suggest you do this.</p> <p>Also changed from descriptions to classes as the ideal code requires unique ids per page</p> <p><a href="http://jsfiddle.net/mdamC/104/" rel="nofollow">http://jsfiddle.net/mdamC/104/</a></p> <p>html</p> <pre><code>&lt;ul id="links"&gt; &lt;li&gt;1&lt;/li&gt; &lt;li&gt;2&lt;/li&gt; &lt;li&gt;3&lt;/li&gt; &lt;li&gt;4&lt;/li&gt; &lt;li&gt;5&lt;/li&gt; &lt;/ul&gt;&lt;br/&gt;&lt;br/&gt; &lt;div id="description"&gt; &lt;ul class="descriptions"&gt; &lt;li&gt;1&lt;/li&gt; &lt;li&gt;1&lt;/li&gt; &lt;li&gt;1&lt;/li&gt; &lt;li&gt;1&lt;/li&gt; &lt;li&gt;1&lt;/li&gt; &lt;/ul&gt; &lt;ul class="descriptions"&gt; &lt;li&gt;2&lt;/li&gt; &lt;li&gt;2&lt;/li&gt; &lt;li&gt;2&lt;/li&gt; &lt;li&gt;2&lt;/li&gt; &lt;li&gt;2&lt;/li&gt; &lt;/ul&gt; &lt;ul class="descriptions"&gt; &lt;li&gt;3&lt;/li&gt; &lt;li&gt;3&lt;/li&gt; &lt;li&gt;3&lt;/li&gt; &lt;li&gt;3&lt;/li&gt; &lt;li&gt;3&lt;/li&gt; &lt;/ul&gt; &lt;ul class="descriptions"&gt; &lt;li&gt;4&lt;/li&gt; &lt;li&gt;4&lt;/li&gt; &lt;li&gt;4&lt;/li&gt; &lt;li&gt;4&lt;/li&gt; &lt;li&gt;4&lt;/li&gt; &lt;/ul&gt; &lt;ul class="descriptions"&gt; &lt;li&gt;5&lt;/li&gt; &lt;li&gt;5&lt;/li&gt; &lt;li&gt;5&lt;/li&gt; &lt;li&gt;5&lt;/li&gt; &lt;li&gt;5&lt;/li&gt; &lt;/ul&gt;&lt;/div&gt; </code></pre> <p>CSS</p> <pre><code>.active{color:red} #description{position:relative} .descriptions{position:absolute; top:0px;} </code></pre> <p>JS</p> <pre><code>$("ul#links li").unbind().bind('click', function(e) { if (e) e.preventDefault(); $(this).toggleClass('active'); $("ul.descriptions").fadeOut(); var index = $(this).index();; $("ul.descriptions").eq(index).fadeIn(); if (!e) e = window.event; e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); }, function(e) { $("ul.descriptions").stop().fadeOut(); }); $("ul.descriptions").hide(); if ($(this).next().is(':hidden')) { $(this).next().removeClass('active'); } $('ul#links li').click(function(e) { e.preventDefault(); $('ul#links li').removeClass('active'); $(this).addClass('active'); }); </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.
    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