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 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
Magnific-popup event binding to popup content
Magnific Popup - Error when opening a you tube video
Magnific-Popup, Limit items to direct siblings
Multiple Galleries with Magnific Popup

Categories

HOME
blogger
kde
google-api-php-client
sd-card
framework7
rsync
sqlite-net-extensions
infragistics
graphql
jsrender
binary-tree
cross-browser
flyway4
upload
gitpitch
google-translate
dax
resize
n-gram
commonmark
orchardcms
ibm-odm
worldwind
aurigma
shared-hosting
extjs5
claims-based-identity
autosys
smb
one-to-many
sparse-matrix
pepper
nhapi
web-api-testing
typo3-6.2.x
log4js-node
kendo-datasource
bpel
nat
binary-data
bosh
amazon-kinesis-kpl
overlap
ws-security
preconditions
reportingservices-2005
texmaker
janrain
import-from-excel
wso2carbon
hendrix
alphabet
powercli
fancybox-2
statsd
flow-control
watchconnectivity
nested-sets
abcpdf9
nxt
home-directory
underscore.js-templating
xml-attribute
player
clang-static-analyzer
qgraphicsview
bgp
php-parse-error
spim
intel-fortran
jmeter-maven-plugin
ideamart
twirl
myo
web-controls
dia
ng-animate
gadt
file-copying
dml
jquery-layout
html5-notifications
ivyde
cdc
anonymous-methods
mt
first-responder
parametric-equations
qtkit
nsmanagedobject
postgresql-performance
ohm
gwt-ext
mod-auth
heartbeat
subgurim-maps
cinema-4d
android-sdk-2.1
datareader
h.323
webkit.net
libs
backcolor
anti-piracy
pascal-fc
geneva-server

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