Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery Sidebar/Panel Close Issue
    text
    copied!<p>I Create one Sidebar/Panel, You can view demo <strong><a href="http://jsfiddle.net/W7sNp/4/" rel="nofollow">Here (JsFiddle)</a></strong></p> <p>Issue is that on Side-panel whenever I click, It Close. My need is Side-panel close only when we click on box which we use to open side panel.</p> <p>Here is my code.</p> <p><strong>HTML</strong> </p> <pre><code>&lt;ul id="dock"&gt; &lt;li id="files"&gt; &lt;ul class="free"&gt; &lt;li class="header"&gt;&lt;a href="javascript:void(0);" class="dock"&gt;&lt;IMG SRC="https://cdn2.iconfinder.com/data/icons/snipicons/500/pin-128.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Dock" style = "padding-top: 12px;"&gt;&lt;/a&gt;&lt;a href="#" class="undock"&gt;&lt;IMG SRC="https://cdn2.iconfinder.com/data/icons/oxygen/48x48/actions/note2.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="" style = "padding-top: 12px;"&gt;&lt;/a&gt;&lt;H5 ID="colorgreen"&gt;DISCOVER &lt;/h4&gt;&lt;/li&gt; &lt;div id="accordion"&gt; &lt;h3&gt;Section 1&lt;/h3&gt; &lt;div class = "accordionheight"&gt; &lt;p&gt; accordion 1 content &lt;/p&gt; &lt;/div&gt; &lt;h3&gt;Section 2&lt;/h3&gt; &lt;div class = "accordionheight"&gt; &lt;p&gt; accordion 2 content &lt;/p&gt; &lt;/div&gt; &lt;h3&gt;Section 3&lt;/h3&gt; &lt;div class = "accordionheight"&gt; &lt;p&gt; accordion 3 content &lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li id="tools"&gt; &lt;ul class="free"&gt; &lt;li class="header"&gt;&lt;a href="#" class="dock"&gt;&lt;IMG SRC="https://cdn2.iconfinder.com/data/icons/snipicons/500/pin-128.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Dock"&gt;&lt;/a&gt;&lt;a href="#" class="undock"&gt;&lt;IMG SRC="https://cdn2.iconfinder.com/data/icons/oxygen/48x48/actions/note2.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Undock"&gt;&lt;/a&gt;&lt;H5 ID="colorgreen"&gt;FACT FILE&lt;/H5&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;This is one item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;This is one item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;This is one item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;This is one item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;This is one item&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p><strong>Jquery</strong></p> <pre><code>$(document).ready(function () { var docked = 0; $("#dock li ul").height($(window).height()); $("#dock li").click(function () { var test = $(this).find("ul").css('width'); if (test == "0px") { $(".docked").addClass("free").removeClass("docked").animate({ right: "-40px", width: '0px' }, 200); $(this).find("ul").addClass("docked").removeClass("free").animate({ right: "40px", width: '180px' }, 200); } else { $(this).find("ul").addClass("free").removeClass("docked").animate({ right: "-40px", width: '0px' }, 200); } }); }); </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