Answer the question
In order to leave comments, you need to log in
Where and how to re-initialize fancybox on ajax load?
After loading with Ajax, fancybox stops working on photos. It turns out you need to re-initialize fancybox. Where can I do it in php? I don't want to mess with js
Answer the question
In order to leave comments, you need to log in
actually it turned out like this) the extention infiniteScroll.IasPager has an onRenderComplete parameter, we push the initialization there)
$this->widget('zii.widgets.CListView', array(
......
pager' => array(
.....
'onRenderComplete' => new CJavaScriptExpression('function () {
$("a[rel=gallery]").fancybox();
}'
)));
live
<?php
$jsCode=<<<'JS'
$('.content').on('click','.fancybox', function(e) {
$(this).fancybox();
});
});
JS;
$this->registerJs($jsCode);
?>
$(document).ajaxStop(function() {
$('.fancybox').fancybox();
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question