2
У меня есть кнопка, чтобы открыть всплывающее окно. Нажимая на себя снова, всплывающее окно должно закрыться (это работает). Но после закрытия невозможно открыть окно. Как я могу исправить эту проблему без привязки?Окно снова не открывается после закрытия - unbind
//loading Popup
//0 means disabled; 1 means enabled;
var popupStatus = 0;
function loadPopup ($elem) {
//loads popup only if it is disabled
if(popupStatus==0){
$elem.fadeIn(300, function(){
//Closing popup by clicking the button
$("#popup-button").bind("click", function(){
disablePopup();
});
});
popupStatus = 1;
}
}
//disable popup
function disablePopup(){
//disables popup only if it is enabled
if(popupStatus==1){
$(".popup-background").fadeOut("slow");
$("#popup-wrapper").fadeOut("slow");
$("#popup-button").unbind("click", function(){
disablePopup();
});
popupStatus = 0;
}
}