$(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