Note that there are some explanatory texts on larger screens.

plurals
  1. POon load first division should be open
    primarykey
    data
    text
    <p>i want when the page loads the first division should be opened by default.also user preference will be taken if user wants to open the first accordion division then on load of a page the first div will be opened,if the users wants to change the preference to second division then second division will open</p> <pre><code>&lt;div class="wrap"&gt; &lt;ul class="accordion1"&gt; &lt;li&gt; &lt;h2 id="first"&gt;CMT&lt;/h2&gt; &lt;div class="content"&gt; &lt;ul class="accord"&gt; &lt;li&gt; &lt;a href="#"&gt;main link1&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Link One&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link Two&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link Three&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link Four&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link Five&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#"&gt;main link2&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Link One&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link Two&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link Three&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link Four&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link Five&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;h2&gt;FOIS&lt;/h2&gt; &lt;div class="content"&gt;content fois&lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;h2&gt;ASP&lt;/h2&gt; &lt;div class="content"&gt;content ASP&lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;h2&gt;PTT&lt;/h2&gt; &lt;div class="content"&gt;content PTT&lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>CSS</p> <pre><code>.wrap { margin-left: 0px; margin-top: 0px; width: 100px; } .accordion1 { width: 178px; margin: 0px; padding: 0px; list-style: none; border: 1px solid #ddd; } .accordion1 h2 { font-size: 12px; font-weight: bold; font-family: Arial, Helvetica, sans-serif; margin: 0px; text-decoration: none; padding: .25em .25em .25em 2em; color: #333; background: url('compo_images/gradient_v_gray.gif') repeat-x; background: url("./compo_images/arrow_exp_s.gif") 1em .75em no-repeat; border-bottom: 1px solid #ddd; cursor: pointer; } .accordion1 h2:hover { background: url('compo_images/gradient_v_orange.gif') repeat-x; color: white; } .accordion1 li div.content { padding: 3px; background: #fcfbfb; border-bottom: 1px solid #ddd; /*border: 1px solid #ddd;*/ } .accordion1 li:hover h2 { color: white; background-image: url("./compo_images/arrow_exp_n.gif"); background: url('compo_images/gradient_v_orange.gif') repeat-x; } .accord &gt; li { padding: 0; list-style-type: none; } .accord &gt; li &gt; a { text-decoration: none; font-family: Arial, Helvetica, sans-serif; font-size: 12px; padding-left: 12px; color: #5f5c5c; background: url("./compo_images/arrow_pointer_se.gif") 0.002em no-repeat; } .accord &gt; li &gt; ul &gt; li &gt; a { text-decoration: none; color: #5f5c5c; font-family: Arial, Helvetica, sans-serif; font-size: 11px; background: url("./compo_images/arrow_dirmini_orange_e.gif") 0.35em no-repeat; padding-left: 17px; } .accord &gt; li &gt; ul { list-style-type: none; text-align: left; margin: 0; padding: 1px; } .accord { text-decoration: none; padding-left: 5px; } .accord &gt; li &gt; a:hover { color: #f8b106; } .accord &gt; li &gt; ul &gt; li &gt; a:hover { color: #f8b106; } .accordion1 &gt; li &gt; h2.active{ background-color: red; } </code></pre> <p>jquery</p> <pre><code>jQuery(function ($) { var $lis = $('.accordion1 &gt; li'), $contents = $lis.children('.content').hide(); var $h2s = $lis.children('h2').click(function(){ var $this = $(this), $t = $this.next(); $contents.not($t).stop(true, true).slideUp(); $this.toggleClass('active', !$t.is(':visible')); $t.slideToggle(); $h2s.not(this).removeClass('active'); }) }) </code></pre> <p>js fiddle <a href="http://jsfiddle.net/dh7Cc/2/" rel="nofollow" title="js fiddle">http://jsfiddle.net/dh7Cc/2/</a></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.
 

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