Hi I am writing a small jQuery script which will toggle a hidden Top-Panel on the site.
My Script is like this:
// Expand Panel
$("#open").click(function(){
$("div#top-panel").slideDown("slow");
});
// Collapse Panel
$("#close").click(function(){
$("div#top-panel").slideUp("slow");
});
// Switch buttons from "Open" to "Close" on click
$("#toppaneltoggle a").click(function () {
$("#toppaneltoggle a").toggle();
});
and the HTML is like this:
<div id="top-panel" class="one">
<div class="wrap">
<div class="widget">
<jdoc:include type="modules" name="top-panel" style="xhtml" />
</div>
</div>
</div>
<div class="tab">
<li id="toppaneltoggle">
<a id="open" class="open" href="#">Checkout Special Offers</a>
<a id="close" style="display: none;" class="close" href="#">Close This Panel</a>
</li>
</div>
Currently on page load the panel state is OPEN however the toggle works fine on clicking the tab it closes. My issue is that I want this panel to be in a CLOSE state on page load and it should open only when clicked on the tab.
How do I achieve that?
Kindly help.
Wouldn't
work?