2016-04-15 25 views
1

私は製品ページを持っており、すべての製品についてモーダルであり、すべてのモーダルはフクロウスライダです。私のフクロウのスライダを破壊した後の修復方法

私は初めての製品ですが、その製品を閉じて別の製品を開くと、フクロウのスライダが壊れています。

私はインターネット上で見つけたすべての解決方法を試しました(または私が試したように感じていますが、それでもわかりません)。ここで

は私のjQueryのです:

var owlCarousel = $('.owl-carousel'); 
$('.modal').on('shown.bs.modal', function (event) { 
    owlCarousel.owlCarousel({ 
    loop: true, 
    items: 1, 
    margin: 100 
    }); 
}); 

$('.modal').on('hidden.bs.modal', function (event) { 
    $('.owl-carousel').trigger('destroy.owl.carousel'); 
}); 

私はよく私の問題を説明願っています!

注:私は2番目の製品を開くと、このエラーは、すべてを示し秒私は

TypeError: null is not an object (evaluating 'this.e._checkVisibile') 

答えて

0

を待つvisibleフクロウカルーセル要素をチェックしてみて、その上に​​とdestroyイベントを呼び出します。 owl.carousel.jsでライン620上

var owlCarousel; 
$('.modal').on('shown.bs.modal', function (event) { 
    owlCarousel = $('.owl-carousel:visible'); 
    owlCarousel.owlCarousel({ 
    loop: true, 
    items: 1, 
    margin: 100 
    }); 
}); 
$('.modal').on('hidden.bs.modal', function (event) { 
    owlCarousel.trigger('destroy.owl.carousel'); 
}); 
+0

おかげで働いたが、私がこれを使用すると、スライダ全体が壊れてしまいます –

+0

あなたはフィドルを提供できますか? – Bhumika107

1

この変更:これに

Owl.prototype.onThrottledResize = function() { 
    window.clearTimeout(this.resizeTimer); 
    this.resizeTimer = window.setTimeout(this.e._onResize, this.settings.responsiveRefreshRate); 
}; 

を:

Owl.prototype.onThrottledResize = function() { 
    if(this.e !=null) { 
     window.clearTimeout(this.resizeTimer); 
     this.resizeTimer = window.setTimeout(this.e._onResize, this.settings.responsiveRefreshRate); 
    } 
}; 

は:)私のためにあなたのコメントを

関連する問題