나는 다음과 같은 jQuery를jQuery에서 함수가 두 번 호출되는 이유는 무엇입니까?
$('img[title*=\"Show\"]').click(function() {
//$e.preventDefault();
var position = $('img[title*=\"Show\"]').parent().position();
$('#popover').css('top', position.top + $('img[title*=\"Show\"]').parent().height() + 150);
console.log(position);
$('#popover').fadeToggle('fast');
if ($('img[title*=\"Show\"]').hasClass('active')) {
$(this).removeClass('active');
} else {
$('img[title*=\"Show\"]').addClass('active');
}
});
내가 제목을 가진 두 개의 이미지가 있습니다 "옵션 표시를." 어떤 이유로이 이미지 중 하나를 클릭 할 때마다 두 번 인쇄됩니다. 이미지가 1 개인 경우 한 번만 인쇄됩니다. 왜 이런거야? 하지 않는 경우