a game on a similar question asked by me, which was kindly answered.
three divs, all hidden. jquery switches between them through different links. it works great! now I would like to click on the link corresponding to the active div and hide it, at the same time as the page loads with all hidden. Now he is disappearing and returning.
help! thank!
HTML:
<div id="nav">
<a class="home" id="show_about" title="About">ABOUT</a><br />
<a class="home" id="show_subscribe" title="Subscribe">SUBSCRIBE</a><br />
<a class="home" id="show_contact" title="Contact">CONTACT</a>
</div>
<div id="content">
<div class="current" id="about">
<p>ABOUT content</p>
</div>
<div id="subscribe">
<p>SUBSCRIBE content</p>
</div>
<div id="contact">
<p>CONTACT content</p>
</div>
</div>
JavaScript:
$(function(){
$('#about').css('display', 'none');
$('#subscribe').css('display', 'none');
$('#contact').css('display', 'none');
});
$('.home').click(function(){
var id = $(this).html().toLowerCase();
$('.current').fadeOut(600, function(){
$('#'+id).fadeIn(600);
$('.current').removeClass('current');
$('#'+id).addClass('current');
});
});
source
share