How to identify the closing event in Magnificpopup

Asked

Viewed 17 times

1

I need to identify where the user clicked to close the lightbox Magnificpopup, as I will perform an action on this.

Option:

  1. -Close x
  2. -Escape
  3. -background that is the dark part

.

$.magnificPopup.open({
                    items: {
                        src: '#thanksModal',
                    },
                    type: 'inline'
                });
    }

1 answer

1

You can use this property:

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

In your case, I would:

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

To learn more, please check the documentation of this plugin.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.