dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.39k stars 3.48k forks source link

Callbacks don't work if a popup was opened from another popup #996

Closed AndreiHudovich closed 1 year ago

AndreiHudovich commented 7 years ago

I have a Login Popup with a link that opens Sign Up Popup (if a user have no account). After closing both of the Popups I need a form cleanup.

PROBLEM: The Login Popup is cleaned without problems, but the Sign Up Form is not cleaned, because callbacks are not triggered.

Login Popup Code

$('#open-login-modal').magnificPopup({
  items: {
    src: '#modal-login',
    type: 'inline'
  },

  midClick: true,
  mainClass: 'mfp-fade',

  callbacks: {
    afterClose: function() {
      cleanUpForm($('#login-form'));
    }
  }
});

Sign Up Popup

$('#open-sign-up-modal').magnificPopup({
  items: {
    src: '#modal-sign-up',
    type: 'inline'
  },

  midClick: true,
  mainClass: 'mfp-fade',

  callbacks: {
    afterClose: function() {
      cleanUpForm($('#sign-up-form'));
    }
  }

});