0

我有在点击时动态加载的项目的缩略图。

这是我拥有的 jQuery:

$.ajax({
    url: '/project/show/',
    type: 'POST',
    data: {_token: CSRF_TOKEN, id: id},
    dataType: 'JSON',
    success: function (data) {
        $('.single-project-heading').text(data[0].title);
        $('.single-project-description').text(data[0].description);
        var projectpictures = '';
        $.each(data[1],function(index,value){
            projectpictures += '<div>' +
                '<a href=\"/' + value.path + '\" data-lightbox=\"' + value.project_id + '\">' +
                '<img class=\"small_thumb\" src=\"/' + value.path + '\">' +
                '</a>';
        });
        owl.html(projectpictures);
        owl.data('owlCarousel').reinit({
            pagination: true,
            items: 5,
            rtl: true
        });
    }
});
  • AJAX 调用后如何重新初始化 owl carousel?
  • 或者有没有更好的方法来做到这一点?

我尝试了文档,但他们没有帮助我。文档说要使用reinit,但它说没有reinit

4

0 回答 0