magnific-popup


Apply callback to all instances of Magnific Popup?


Is there a way to bind an event callback so that it's called for all instances of Magnific Popup? On a site I'm building several elements have fixed position and "jump" when the main browser scrollbar disappears. I want to set a callback to add padding for those elements before any popup is opened, and remove the padding when the popup is closed. I don't want to re-use the callbacks every time I initialize Magnific Popup – I'd rather set one set of callbacks that is run every time Magnific opens and closes a popup.
My first thought was to use event delegation and bind pretty high in the document tree. I was trying to bind to the mfpOpen event and listen on the BODY tag, but it doesn't seem like the event bubbles. Is there another solution?
Events are dispatched only on target element or on document (if target element is not present).
But you may override open function globally using prototype, e.g.:
$.magnificPopup.instance.open = function(data) {
console.log('before open anything');
$.magnificPopup.proto.open.call(this,data);
console.log('after open anything');
};
You may do the same thing with close function (it doesn't have any arguments).

Related Links

How to set the divs to make Magnific Popup animations work
how to display map in mobile devices using magnific popup?
Magnific Popup - Counter in Videogallery
how to manually open and close the popup using Magnific-Popup
How to customize arrows and close button?
no closing “X” with inline content
How to prevent close
Magnific-Popup Loading iframe from non-video players URL
Magnific popup - put arrows inside of an image
magnific closeOnContentClick does not work
How can style popup iframe in Magnific Pop-Up?
Gallery with mixed content types
Title for iframe/video in magnific popup
Magnific Popup: Close floats to the right
Calling magnific-popup on button element instead of an anchor
Implement query.magnific-popup.js in dreamweaver cs5. Syntax error in original code

Categories

HOME
ionic-framework
jdo
blogger
webstorm
google-docs
yarn
packages
installshield
midi
qt-creator
google-cloud-ml
vb.net-2010
designer
libtiff
tostring
http-status-code-504
oracle-coherence
interop
swiftlint
tokenize
functional-testing
arabic
rundeck
microsoft-sync-framework
xacml
replaceall
objectanimator
nat
socialengine
binary-data
airconsole
scorm2004
gtrendsr
catch-all
phpfreechat
mozilla
jmonkeyengine
file-format
libraries
impersonation
android-fingerprint-api
broadcastreceiver
janrain
no-www
node-sass
scorm
qwt
chain-builder
atomicity
integrity
forever
google-perftools
r-forge
sqlbulkcopy
parallel-data-warehouse
medium.com
ableton-live
disque
nsviewcontroller
pickadate
bluegiga
historian
ios8-today-widget
google-places
icu4j
wireshark-dissector
computer-algebra-systems
generic-programming
p2
javax.mail
formatjs
dia
gui-test-framework
nsbutton
preferences
responsive-slides
rebol3
transcoding
openlaszlo
ivyde
quantlib-swig
gridfs
tws
bulkloader
seed
html-editor
flashvars
http-unit
angularjs-controller
typoscript2
pvrtc
funscript
gdata-api
hosts-file
assembly-loading
cufon
netdna-api
libc++
mysql-error-1005
telerik-scheduler
remember-me
radcombobox
site.master
paster
dbal
webkit.net
libs
swing-app-framework
gacutil
mediarss
scripting-languages
ajax-forms

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App