我正在尝试编写一个函数,该函数现在允许一次出现多个弹出窗口。目前我的代码如下所示:
// Click for full bio
$('.div').click(function() {
if('.popup'.!open) // if popup NOT open, then do this..
$(this).find('.popup').toggle();
});
有任何想法吗?
我会亲自在某处创建一个标志来跟踪状态。
如果你复制它,这个例子将不起作用,但它应该让你清楚地知道你需要做什么......
var isPopupOpen = false;
$('.toggleLink').click(function() {
if(!isPopupOpen){
$(this).find('.popup').show();
isPopupOpen = true;
}
});
//this is the bit that don't work, as I don't know what methods you have to be able to detect when it closes
$('.popup').onClose(function() {
isPopupOpen = false;
});