Skip to content

Commit

Permalink
Added ajaxContentAdded event that fires after content is added to DO…
Browse files Browse the repository at this point in the history
…M. + fixed issue that could prevent modifying of responseText
  • Loading branch information
dimsemenov committed Jun 4, 2013
1 parent 90bb326 commit efe8cec
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
12 changes: 9 additions & 3 deletions dist/jquery.magnific-popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Private static constants
*/
var CLOSE_EVENT = 'Close',
AFTER_CLOSE_EVENT = 'AfterClose',
BEFORE_APPEND_EVENT = 'BeforeAppend',
MARKUP_PARSE_EVENT = 'MarkupParse',
OPEN_EVENT = 'Open',
Expand Down Expand Up @@ -446,6 +447,8 @@ MagnificPopup.prototype = {
mfp.content = null;
mfp.currTemplate = null;
mfp.prevHeight = 0;

_mfpTrigger(AFTER_CLOSE_EVENT);
},

updateSize: function(winHeight) {
Expand Down Expand Up @@ -1020,9 +1023,11 @@ $.magnificPopup.registerModule(AJAX_NS, {
url: item.src,
success: function(data, textStatus, jqXHR) {

_mfpTrigger('ParseAjax', jqXHR);
var data = {responseText:jqXHR.responseText};

_mfpTrigger('ParseAjax', data);

mfp.appendContent( $(jqXHR.responseText), AJAX_NS );
mfp.appendContent( $(data.responseText), AJAX_NS );

item.finished = true;

Expand All @@ -1035,7 +1040,8 @@ $.magnificPopup.registerModule(AJAX_NS, {
}, 16);

mfp.updateStatus('ready');


_mfpTrigger('AjaxContentAdded');
},
error: function() {
_removeAjaxCursor();
Expand Down
Loading

0 comments on commit efe8cec

Please sign in to comment.