C5-8.2.1: magnificPopup only works on second click
Permalink
Hi!
I'm trying to make a conditional magnificPopup for a link click. The problem is the condition is required after the link is clicked. But to open the magnificPopup a click event is required which has already happened just before this. Thus the magnificPopup only opens on the 2nd click, not the 1st. Any one know how to make it open on the first click with condition? Here's the code:
Thank you.
I'm trying to make a conditional magnificPopup for a link click. The problem is the condition is required after the link is clicked. But to open the magnificPopup a click event is required which has already happened just before this. Thus the magnificPopup only opens on the 2nd click, not the 1st. Any one know how to make it open on the first click with condition? Here's the code:
$('.form-a').on('click', function() { if (popup == true) { $('.form-a').magnificPopup({ type: 'inline', ... $.magnificPopup.open({ ... // this instead throws an exception "TypeError: c is undefined jquery-magnific-popup.js:1:5230"
Thank you.
However, for some reason initializing the popup directly $('.form-a').magnificPopup({ works slightly different to $.magnificPopup.open({.
Option focus: '#name' - works with the former initialization. But it loses focus on the element with the latter.
Any ides why? How to make it keep focus?