【发布时间】:2023-03-20 10:38:01
【问题描述】:
请帮忙!我一直在试图弄清楚当它已经打开时如何关闭一个特定的 DIV。
例如请查看:http://jsfiddle.net/WGRvw/
如果我点击 BC,DIV 应该会出现,但如果我再次点击它,DIV 应该会消失,但我不知道如何让它消失。另外,我只希望一次出现一个 DIV。
我试着做一个 else:
$(function(){ $(document).ready(function () { $(".prov").click(function(){ $(".clearfix").hide(); });
$('#BC').hide();
$('#BC-show').click(function () {
if( $('#BC').toggle('slow')) {
return false;
}
else {
$('#BC').hide();
}
});
$('#AB').hide();
$('#AB-show').click(function () {
if($('#AB').toggle('slow')) {
return false;
}
else {
$('#AB').hide();
}
});
});
});
});
感谢您的帮助。
谢谢!
【问题讨论】:
-
固定在这里:jsfiddle.net/WGRvw/141
标签: jquery html hide toggle show