Making a jQuery Isotope layout initialize inside a Bootstrap Tab

前端 未结 2 403
旧时难觅i
旧时难觅i 2021-01-28 11:40

I have a bootstrap tab control with 4 tabs. My Isotope code is inside the 3rd tab. But when I navigate to that tab, the layout is not engaged (All the images are on their own li

2条回答
  •  悲哀的现实
    2021-01-28 12:04

    The answer by Karine is great but it might not work in recent versions because the method "reLayout" has been renamed to "layout".

    So instead of

    $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
      $('.grid').isotope('reLayout');
    });
    

    please use

     $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
      $('.grid').isotope('layout');
    });
    

提交回复
热议问题