Answer the question
In order to leave comments, you need to log in
How to parse ajax in callback(e)?
There is an execution script that executes the following image carousel, when clicked, the magnific popup script fires, which creates a tpl page with another carousel, which should be parsed in callback, but nothing comes out of you, even the console log callback does not work.
<script>
$(document).ready(function () {
$('.owl-carousel').owlCarousel({
loop: false,
margin: 10,
nav: true,
responsive: {
0: {
items: 1
},
600: {
items: 3
},
1000: {
items: 5
}
}
});
$('.open-popup-link').on('click', function () {
var post_id = $(this).attr('data-post_id');
$.magnificPopup.open({
type: 'ajax',
items: {
src: 'index.php?route=instagram/instagram/getMedia&post_id=' + post_id,
},
callbacks:
{
parseAjax: function () {
console.log("callback called! "),
$('.owl-carouseles').owlCarousel({
loop: false,
margin: 100,
nav: true,
responsive: {
0: {
items: 1
},
600: {
items: 3
},
1000: {
items: 5
}
}
})
}
}
});
});
});
</script>
<div class="owl-carouseles">
<?php foreach ($posts as $post) { ?>
<div class="item">
<?php if (isset ($post['image'])) { ?>
<img src="<?= $post['image']; ?>">
<?php } ?>
<?php if (!empty($post['video'])) { ?>
<video src="<?= $post['video']; ?>" height="640" autoplay loop></video>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question