making a link toggle between SlideDown and SlideUp (scriptaculous)
-
05-07-2019 - |
Question
The scriptaculous wiki has a demo (http://github.com/madrobby/scriptaculous/wikis/effect-slidedown) that shows the SlideDown effect in use. However I need to have the same link to slide down if a certain DIV is hidden and SlideUp if that DIV is showing.
How do I achieve this?
Thanks.
Solution
Use Effect.toggle.
Effect.toggle('element_id', 'slide');
OTHER TIPS
Wrap it in a function, call the function instead.
function slideMe(myDiv) {
if(Element.visible(myDiv)) {
//slide up
}
else {
//slide down
}
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow