【发布时间】:2018-03-18 22:53:47
【问题描述】:
我需要在 click 函数中添加 else 语句,以便在第二次单击按钮时 .container 消失。
function() {
$('div.container').css({'width':'350px'});
} else {
$('div.container').css({'width':'0'});
}
});
编辑:
我需要元素在单击按钮时向左切换。
【问题讨论】:
-
if()在哪里? -
不确定在哪里添加 if
-
使用 toggleClass() 和 css 来做到这一点。如果单击相同按钮两次以上会发生什么?
-
我想用 .animate({ width: 'toggle'},
标签: javascript jquery css css-animations