How to identify the close event in MagnificPopup

1

I need to identify where the user clicked to close the lightbox MagnificPopup, because I'm going to take action on that.

Option:

  • -Close x
  • -Escape
  • -background which is the dark part
  • .

    $.magnificPopup.open({
                        items: {
                            src: '#thanksModal',
                        },
                        type: 'inline'
                    });
        }
    
        
    asked by anonymous 12.04.2018 / 02:21

    1 answer

    1

    You can use this property:

    close: function() {
      console.log('Acabo de fechar.');
    }
    

    In your case, it would look like:

    $.magnificPopup.open({
      items: {
        src: '#thanksModal',
      },
      type: 'inline',
      close: function() {
        console.log('Acabo de fechar!');
      }
    });
    

    To learn more, check out this documentation of this plugin.

        
    12.04.2018 / 02:32