最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - making a link toggle between SlideDown and SlideUp (scriptaculous) - Stack Overflow

programmeradmin1浏览0评论

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

    }
}
发布评论

评论列表(0)

  1. 暂无评论