2

バックグラウンド:

easytabs.js インスタンス内に glide.js スライド ショーのインスタンスがあるという問題があります。ウィンドウ サイズが変更されると、css メディア クエリが glide.js インスタンスに対して適切に開始されません。これは、easytabs.js が glide.js インスタンスの最後の状態をキャッシュしているため、そのタブが新しい​​ウィンドウ サイズで再度開かれたときに、それに応じて glide.js インスタンスのサイズが変更されないために発生したようです。

質問:

glide.js API 関数を使用しようとしています.refresh()が、適用すると「TypeError: glide is undefined」というメッセージが表示されます。コードは次のとおりです。

   $('#glide').glide({
      type: "carousel", 
      autoheight: "true",
      animationDuration: 600
    });

    var glide = $('#glide').glide().data('api_glide');

    $('.tab-button').click(function(){
      console.log("Button 1 Clicked"); 
      glide.refresh();
    });

私が間違っているかもしれないアイデアはありますか?

4

1 に答える 1

3

I just had problems with using the API too, but I got it. To get the API, try this:

var glide_api = $("#glide").data('glide_api');
glide_api.refresh();

You don't need to call glide() between the selector and the data-function to get the API. Also, the name of the api is glide_api, not api_glide.

于 2015-11-30T12:29:35.463 に答える