You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/documentation.md
+21-12Lines changed: 21 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -927,8 +927,11 @@ callbacks: {
927
927
console.log('Start of popup initialization');
928
928
},
929
929
elementParse: function(item) {
930
+
// Function will fire for each target element
931
+
// "item.el" is a target DOM element (if present)
932
+
// "item.src" is a source that you may modify
933
+
930
934
console.log('Parsing content. Item object that is being parsed:', item);
931
-
// feel free to modify here item object
932
935
},
933
936
change: function() {
934
937
console.log('Content changed');
@@ -964,12 +967,6 @@ callbacks: {
964
967
// "data.text" - text that will be displayed (e.g. "Loading...")
965
968
// you may modify this properties to change current status or its text dynamically
966
969
},
967
-
elementParse: function(item) {
968
-
console.log('Parsing element:', item);
969
-
// triggers only once for each item
970
-
// here you may modify URL, type, or any other data
971
-
},
972
-
973
970
imageLoadComplete: function() {
974
971
// fires when image in current popup finished loading
975
972
// avaiable since v0.9.0
@@ -1155,17 +1152,29 @@ See [example on CodePen](http://codepen.io/dimsemenov/pen/JGjHK).
1155
1152
1156
1153
### How to override some function without modifying the source files?
1157
1154
1158
-
Rewrite the function that you wish to modify by editing Magnific Popup class prototype, you can access it like so `$.magnificPopup.proto`. For example to override function that sets focus on some element:
1155
+
Rewrite the function that you wish to modify by editing Magnific Popup object, you can access it like so `$.magnificPopup.instance`. For example to override function that goes to "next" item in gallery:
1159
1156
1160
1157
{% highlight javascript %}
1161
-
// add this code after popup JS file is included, but before popup is initialized
Improve this documentation page <ahref="https://github.com/dimsemenov/Magnific-Popup/edit/master/website/documentation.md">via GitHub</a> (simply submit commit). Any improvements, including your own CodePen examples are very welcome.
1178
+
Improve this documentation page <ahref="https://github.com/dimsemenov/Magnific-Popup/edit/master/website/documentation.md">via GitHub</a> (simply submit commit). Any improvements, including your own CodePen examples are very welcome. And, lastly, don't forget to star the script on GitHub:
<h2class="intro">Magnific Popup is a responsive jQuery lightbox plugin that is focused on performance and providing best experience for user with any device (Zepto.js compatible).</h2>
0 commit comments