admin管理员组

文章数量:1356291

The scriptaculous wiki has a demo () 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.

The scriptaculous wiki has a demo (http://github./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.

Share Improve this question asked Oct 29, 2008 at 18:16 GezimGezim 7,32811 gold badges68 silver badges106 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

Use Effect.toggle.

Effect.toggle('element_id', 'slide');

Wrap it in a function, call the function instead.

function slideMe(myDiv) {

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

    }

    else {

    //slide down

    }
}

本文标签: javascriptmaking a link toggle between SlideDown and SlideUp (scriptaculous)Stack Overflow