I currently have the following code set up for a jQuery slide.
$(document).ready(function () {
$('a#slide-up').click(function () {
$('.slide-container').slideUp();
return false;
});
$('a#slide-toggle').click(function () {
if ($('.slide-container').is(':visible')) {
$('.slide-container').slideUp();
$(this).removeClass('active');
} else {
$('.slide-container').slideDown();
$(this).addClass('active');
}
});
});
And the html:
<a id="slide-toggle"></a>
<div class="slide-container">
<a id="slide-up"></a>
>>content<<
</div>
When I click on #slide-toggle, the class 'active' gets applied to it and div.slide-container slides down revealing the content and another link to slide the container back up (i.e a#slide-up). When I click on a#slide-up, the container slides back up but a#slide-toggle remains "active" with the class applied to it.
I want it so that when I click on a#slide-up, the 'active' class gets removed. How can I do this?
-edit-
$(document).ready(function() {
$('a#slide-up').click(function () {
$('.slide-container').slideUp(function(){
$('#slide-toggle').removeClass('active');
});
return false;
});
$('a#slide-toggle').click(function() {
if ($('.slide-container').is(':visible')) {
$('.slide-container').slideUp(function() {
$(this).removeClass('active');
}
})
else {
$('.slide-container').slideDown();
$(this).addClass('active');
}
});
});