3

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.

Gezim
  • 7,112
  • 10
  • 62
  • 98

2 Answers2

8

Use Effect.toggle.

Effect.toggle('element_id', 'slide');
ceejayoz
  • 176,543
  • 40
  • 303
  • 368
1

Wrap it in a function, call the function instead.

function slideMe(myDiv) {

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

    }

    else {

    //slide down

    }
}
Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176