owl carousel not working after ajax load

断了今生、忘了曾经 提交于 2019-12-13 07:16:34

问题


i use jquery 1.11 and this code to ajax load wordpress post content in sidebar . everything is good but jquery functions of owl carousel not work and the carousel in post content not showing anything. ajaxify code to load post content:

$(document).ready(function(){
$.ajaxSetup({cache:false});
$(".post-link").click(function(){
    var post_link = $(this).attr("href")+' #content';
    $("#single-post-container").html("loading ...");
    $("#single-post-container").load(post_link);
return false;
});

});

is there any way to solve this problem and conflict? best regards.


回答1:


This worked for me :

jQuery(function () {
  jQuery(document).ready(function () {
    setInterval(function () {
      jQuery(".owl-carousel").owlCarousel();
    }, 1500);
  });
});


来源:https://stackoverflow.com/questions/27903139/owl-carousel-not-working-after-ajax-load

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!