здесь после того, как я присвоил переменной «img» значение null в слайд-модуле и вызвал «click on imageGallery» значение img «undefined», почему это так?Невозможно присвоить значение null переменной jQuery
$(".imageGallery").click(function(){
console.log(img+"first");
var img = $(this).attr("src"); //image source
console.log(img+"second");
var num = $(this).attr("alt"); //image name
$('#popup').slideDown("600",function(){
$(this).html("<div> <p>"+num+"</p> </div> <img src="+img+">");
$("#popup p").addClass("popupName");
$("#popup img").addClass("popupImg");
$("#popup div").addClass("popupNameBg");
})
$('#popup').click(function(){
$('#popup').slideUp("500");
img = null;
console.log(img+"third");
return false;
})
})
есть клик внутри одним щелчком .... плохой плохая идея. – epascarello
Откройте консоль с помощью F12, введите «null == undefined» –