Last active
December 16, 2022 12:35
-
-
Save amurrell/0b78cccf0e1554846d50 to your computer and use it in GitHub Desktop.
MagnificPopup Open - not from a link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If you do not want to open a popup from a user clicking a button, | |
// and your popup container is already on the page (footer?) hidden... | |
$.magnificPopup.open({ | |
items: { | |
src: $('#modal-container') | |
}, | |
type: 'inline', | |
mainClass: 'mfp-fade' | |
}); | |
// If you want to make your own close button... | |
$.magnificPopup.open({ | |
items: { | |
src: $('#cta-funnel-travel') | |
}, | |
callbacks: { | |
open: function(){ | |
// this.content is your modal div ID, jquery object. | |
this.content.find('.your-button').click(function(){ | |
$.magnificPopup.close(); | |
}); | |
} | |
}, | |
type: 'inline', | |
mainClass: 'mfp-fade', | |
// closeOnBgClick: false, // Disable bg click to close | |
// showCloseBtn: false, // Disable the top corner close button | |
modal: true // short cut to disabling the background close, content close, escape close etc, top corner close | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment