Add flexslider(s) on Jquery UI tabs - making them work

﹥>﹥吖頭↗ 提交于 2019-12-11 16:41:25

问题


I have a flexslider working on the first Jquery UI tab, but when I place on the second one its a nogo....anyone know what else you have to add to make this function work? I included a Jfiddle of the one thats not working:

$('#slider').flexslider({
                animation: "slide",
                controlNav: false,
                animationLoop: false,
                slideshow: false
            });

$('#slider2').flexslider({
                animation: "slide",
                controlNav: false,
                animationLoop: false,
                slideshow: false
            });

JFIDDLE

That link had answers but nothing proof working.... I saw Advanced Slider has this method to make it work:

<script type="text/javascript">
jQuery(document).ready(function($) {
     $(".ui-tabs").tabs({ select: function (event, ui) {
          if ($(ui.panel).find('.advanced-slider').length) {
               var interval = setInterval(function() {
                    if ($(ui.panel).css('display') == 'block') {
                         $('.advanced-slider').advancedSlider().doSliderLayout();
                         clearInterval(interval);
                    }
               }, 100);
          }
     }});
});
</script>

From this link:

LINK

So I'm wondering if how I would implement this to flexslider.


回答1:


I found a way!

@isherwood thanks your way was close but it did help me figure to set the ui tabs css:

.ui-tabs__panel {
    display: block !important;
    position: absolute;
    opacity: 0;
    z-index:0;
    top: 5em;
    left: -9999em
}

.ui-tabs__panel--active {
    opacity: 1;
    z-index:1;
    left: 0;
}


来源:https://stackoverflow.com/questions/18154105/add-flexsliders-on-jquery-ui-tabs-making-them-work

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