[英]Simple jQuery click event issue
I'm using a simple jQuery content panel switcher that I am trying to add a close button to. 我正在使用一个简单的jQuery内容面板切换器,试图将其添加一个关闭按钮。 The close button is working but then after using the close button I can't re-open a panel again.
关闭按钮可以正常工作,但是使用关闭按钮后,我无法再次打开面板。 The code for the panel switcher plugin is below:
面板切换器插件的代码如下:
jcps.fader = function(speed, target, panel) {
jcps.show(target, panel);
if (panel == null) {panel = ''};
$('.switcher' + panel).click(function() {
var _contentId = '#' + $(this).attr('id') + '-content';
var _content = $(_contentId).html();
if (speed == 0) {
$(target).html(_content);
}
else {
$(target).fadeToggle(speed, function(){$(this).html(_content);}).fadeToggle(speed);
}
});
};
And here is the call in my HTML page that I have added the click event to: 这是我的HTML页面中将click事件添加到的调用:
$(document).ready(function() {
jcps.fader(300, '#switcher-panel');
$(".close").live('click',function(){
$(".content").fadeOut("slow");
});
});
This all works fine for closing the content panel but I am unable to open a panel again after clicking close. 所有这些对于关闭内容面板都可以正常工作,但是单击关闭后,我无法再次打开面板。
Does this apply/make sense? 这是否适用/有意义?
edit-- 编辑 -
$(document).ready(function() {
jcps.fader(300, '#switcher-panel');
$(".close").live('click',function(){
if (Clicked == true){
//run jquery code to hide
} else {
//run jquery code to show
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.