Created
December 13, 2012 17:47
-
-
Save karloscarweber/4278245 to your computer and use it in GitHub Desktop.
A jQuery panel switcher. It alternates between different panelSlides
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="panel-container"> | |
<a class="panelSwitch"> | |
<h5>button</h5> | |
</a><!-- End of .panelSwitch --> | |
<div style="" class="panelBoard"> | |
<!-- Fill me with any content --> | |
</div><!-- End of .panelBoard --> | |
<a class="panelSwitch"> | |
<h5>button</h5> | |
</a><!-- End of .panelSwitch --> | |
<div style="" class="panelBoard"> | |
<!-- Fill me with any content --> | |
</div><!-- End of .panelBoard --> | |
<a class="panelSwitch"> | |
<h5>button</h5> | |
</a><!-- End of .panelSwitch --> | |
<div style="" class="panelBoard"> | |
<!-- Fill me with any content --> | |
</div><!-- End of .panelBoard --> | |
<a class="panelSwitch"> | |
<h5>button</h5> | |
</a><!-- End of .panelSwitch --> | |
<div style="" class="panelBoard"> | |
<!-- Fill me with any content --> | |
</div><!-- End of .panelBoard --> | |
<a class="panelSwitch"> | |
<h5>button</h5> | |
</a><!-- End of .panelSwitch --> | |
<div style="" class="panelBoard"> | |
<!-- Fill me with any content --> | |
</div><!-- End of .panelBoard --> | |
<a class="panelSwitch"> | |
<h5>button</h5> | |
</a><!-- End of .panelSwitch --> | |
<div style="" class="panelBoard"> | |
<!-- Fill me with any content --> | |
</div><!-- End of .panelBoard --> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".panelSwitch").click(function() { | |
var state = $(this).next().css("display"); | |
if (state == 'none') { | |
// If I am hidden! | |
// Remove active state and Slide up everyone. | |
$(".panelSwitch + .panelBoard").slideUp(); | |
//and slide down my content | |
$(this).next().slideDown(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment