Open MartaLoBalastegui opened 5 years ago
I'm experiencing the same issue. When the close icon is clicked, the popup will disappear but the modal stays and throws this error. If I click outside the popup, both the popup and the modal disappears successfully. Why would clicking outside work but clicking the x icon doesn't?
Uncaught TypeError: b.find is not a function
at a.fn.init.<anonymous> (magnific.min.js?ver=4.4.7::3)
at Function.each (jquery.js?ver=1.12.4:2)
at o._parseMarkup (magnific.min.js?ver=4.4.7:3)
at o.getInline (magnific.min.js?ver=4.4.7:3)
at o.updateItemHTML (magnific.min.js?ver=4.4.7:3)
at open (magnific.min.js?ver=4.4.7:3)
at o._openClick (magnific.min.js?ver=4.4.7:3)
at HTMLDivElement.c (magnific.min.js?ver=4.4.7:3)
at HTMLDivElement.dispatch (jquery.js?ver=1.12.4:3)
at HTMLDivElement.r.handle (jquery.js?ver=1.12.4:3)
I'm actually experiencing the exact same thing right now. Strange as it seems only applicable when closing the modal via clicking the button rather than the mask layer.
Anyone find a reason for this?
I'm actually experiencing the exact same thing right now - can't find solution, custom button make same behaviour
Can confirm, just ran into the same issue.
Hi guys, I have this error too but I found a solution. For popup I have these settings:
$('.portfolio_popup').magnificPopup({
type: 'inline',
midClick: true,
preloader: false,
mainClass: 'portfolio_popup_wrap mfp_bg_none',
removalDelay: 300,
closeOnBgClick: false,
closeBtnInside: false,
showCloseBtn: false,
});
Settings below important for create our button which will close popup without error:
closeOnBgClick: false,
closeBtnInside: false,
showCloseBtn: false,
Also, I set the button inner popup which closes popup:
<button onclick="closePopup();" type="button" class="mfp-close">×</button>
Also, we need to add closePopup() function which closes popup when the user clicks it. We need to add it in our JS code:
//Close popup function
function closePopup() {
$.magnificPopup.close();
}
I hope this information will helpful to you. Thanks.
@lifelistdev thanks for this.
I get this error not on closing the popup, but on opening it.
I found that if I just add
closeOnBgClick: true,
closeBtnInside: false,
showCloseBtn: false,
The problem goes away. If I set closeOnBgClick: false,
I get another error. Probably because I didn't create a button and function for closing the popup. Likewise, if I exclude the
closeBtnInside: false,
showCloseBtn: false,
then the problem comes back.
I'm fine with how it is for my application - no close button at all and the user can just click outside the popup window to close the popup.
I discovered that my problem was due to the element also having image. I had set the same class for both the img and elements, but the href was obviously part of the element. So, when I click on the image, it couldn't find the href, but would find it later because its embedded within the item. When I removed the class from the , this problem went away. I am not using any of the code mentioned above.
changed
<a href=".popup" class="open-popup-link..."><img src="asdf" class='open-popup-link...'></img><span>Popup</span></a>
to
<a href=".popup" class="open-popup-link..."><img src="asdf" class='...'></img><span>Popup</span></a>
and then the script uses
$(".open-popup-link").magnificPopup({
I'm trying to assign a function when the close button of my pop-up is clicked:
But the alert is never displayed as an error is produced, the message in the console: "b.find is not a function"
Many thanks!