I currently have the following code installed for the 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 html:
<a id="slide-toggle"></a>
<div class="slide-container">
<a id="slide-up"></a>
>>content<<
</div>
When I click on # slide-toggle, the "active" class is applied to it, and the div.slide container moves down, showing the contents and another link, to copy the backup of the container (i.e. # slide-up). When I click on the # slide-up, the container will shift, but the # slide switch remains βactiveβ with the class applied to it.
I want that when I click on # slide-up, the 'active' class is 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');
}
});
});
source
share