86
rated 0 times
[
87]
[
1]
/ answers: 1 / hits: 75542
/ 13 Years ago, sat, march 12, 2011, 12:00:00
I am using the following code to open and close a div ( slide up/down ) using js
I have the slide down event attached to a button and the slide up event sttached to close text.
What I want is the button onclick to open and onclick again close the slide element.
Here is the JS
// slide down effect
$(function(){
$('.grabPromo').click(function(){
var parent = $(this).parents('.promo');
$(parent).find('.slideDown').slideDown();
});
$('.closeSlide').click(function(){
var parent = $(this).parents('.promo');
$(parent).find('.slideDown').slideUp();
});
});
The HTML:
<span class=grabPromo>Open</span>
and in the slide down area i have
<a class=closeSlide>Close</a>
Any help appreciated.
Ideally I want a down pointing arrow on the slide down button and a up pointing arrow to replace it to slide up on same button. And do away with the close link altogether.
Any help appreciated. Cheers
More From » jquery