jQuery切换slideUp/slideDown [英] jquery toggle slideUp/slideDown

查看:78
本文介绍了jQuery切换slideUp/slideDown的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个div#items,如果单击它,则div#choices slideDown().如果再次单击,则div#choices应该使用slideUp();如何测试选择是否已减少或增加?我知道我可以存储一个变量并在单击div#items时切换其值,但是如果#choices已经通过其他方式滑落了怎么办?

I've got a div#items and if it's clicked then div#choices slideDown(). If it's clicked again then div#choices should slideUp(); How can I test if choices is down or up already? I know I could store in a variable and toggle it's value whenever div#items is clicked, but what if #choices has been slid down by other means?

推荐答案

使用.slideToggle()

Use .slideToggle()

这篇关于jQuery切换slideUp/slideDown的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆