Having established the connection between SlideDown and SlideUp (scriptaculous)

The scriptaculous quiz has a demo version ( http://github.com/madrobby/scriptaculous/wikis/effect-slidedown ) that shows the effect of SlideDown. However, I need the same link to slide down if some DIV is hidden and SlideUp if this DIV is shown.

How do I achieve this?

Thank.

+3
source share
2 answers

Use Effect.toggle .

Effect.toggle('element_id', 'slide');
+8
source

Wrap it in a function, call the function.

function slideMe(myDiv) {

    if(Element.visible(myDiv)) {
    //slide up

    }

    else {

    //slide down

    }
}
+1
source

Source: https://habr.com/ru/post/1698883/


All Articles