我正在使用jquery .show
打開div
。我已經可以正常工作了,但我在處理如何檢查div
是否已經打開時遇到了一些麻煩。如果是這樣,我不希望它重複.show
函數。什麼是最好的方法來做到這一點?點擊,檢查div是否打開,如果爲false - 使用.show打開,如果爲true
我使用的時刻是什麼(jQuery的+ jQuery UI的)
$(document).ready(function() {
$('.content').hide();
$(".open").click(function() {
$(".content").show("slide", { direction: "up" },1200);
});
$(".close").click(function() {
$(".content").hide("slide", { direction: "up" },1200);
});
});
http://api.jquery.com/toggle/ – Gary 2012-04-21 15:49:52