$(document).ready(function() {
$(".LeftColumn").hide();
$(".SidebarToggle").toggle(function() {
$(this).addClass("active");
$(this).text("Hide Sidebar");
$(this).attr("title", "Hide Sidebar");
$(".LeftColumn").fadeIn("fast");
return false;
},
function() {
$(this).removeClass("active");
$(this).text("Show Sidebar");
$(this).attr("title", "Show Sidebar");
$(".LeftColumn").fadeOut("fast");
return false;
});
$(document).mouseup(function() {
$('.LeftColumn').fadeOut('fast');
$('.SidebarToggle').removeClass("active");
$('.SidebarToggle').text("Show Sidebar");
})
});
,當用戶點擊它會隱藏LeftColumn,因爲我想在頁面上的其他地方我的問題是,但切換功能不知道會這樣,當用戶點擊SidebarToggle不會將其鏈接顯示LeftColumn,因爲它將其視爲隱藏。我怎樣才能解決這個問題?jQuery的切換功能
由於
雖然按鈕不再關閉LeftColumn,但您只能通過單擊頁面上的其他位置來關閉它。我想關閉這兩個操作。 – Cameron 2010-06-24 10:03:47
@Cameron - 該按鈕是否從「active」類開始? – 2010-06-24 10:06:43
------ @Nick No – Cameron 2010-06-24 10:09:18