I am building a website page that has like 16 items of apparel.
I want a simple text navigation that has the option to show and hide products that are either for Men, Women, and All.
Navigation
<ul class="sortNav">
<li class="first">View:</li>
<li class="men button">Men</li>
<li class="women button">Women</li>
<li class="all button active">All</li>
</ul>
Products Code
<span class="prod men">Guys shirt</span>
<span class="prod men">Guys Pant </span>
<span class="prod women">Girls Pant</span>
<span class="prod women">Girls Pant</span>
Tricky part
Only one button can be "active". And only that class will be visible (one or two) will be triggered.
Thanks in advance.
Thanks! Kinda combined the two responses. Check this out...
$('.products li.prod').toggle(true);
$('.sortNav li.button').click(function () {
$('.sortNav li.button').removeClass('active');
$(this).addClass('active'); });
$('.sortNav li.men').click(function () {
$('.products li.prod').toggle(false);
$('.products li.men').toggle(true); });
$('.sortNav li.women').click(function () {
$('.products li.prod').toggle(false);
$('.products li.women').toggle(true); });
$('.sortNav li.all').click(function () {
$('.products li.prod').toggle(true);
activeclass from each one right?