0

当滑块到达最后一项时,我希望选项卡循环到下一个选项卡。

这是一个小提琴。我把flexslider旋转木马放在jqueryeasytabs里面。

由于我只是一个初学者,这是我的脚本:

if (target === slider.last) {
  EASYTABS MOVE AUTOMATICLY TO THE NEXT TAB       
}

修订

抱歉。我只有一个带有 4 个选项卡(面板)的 easytab,每个选项卡都有一个轮播。我想在 flexslider 到达最后一项时循环它们。可能吗?

4

1 回答 1

0

我想我正确地解释了您的问题:您在页面上有一个 flexslider 幻灯片和一组 easytabs 选项卡,并且您希望每次幻灯片播放结束时选择下一个选项卡,在一个永久循环中,对吗?

如果是这样 ...

Flexslider 有一个名为 'end' 的回调,当幻灯片播放到最后一张幻灯片时触发,因此您需要绑定一个方法,在 flexslider 调用中使用类似以下内容的方法将选项卡递增到该方法:

// an array of the selectors for the tabs themselves
easyTabSelectors = ['#tab-1','#tab-1','#tab-1'];

// a reference to the currently active tab by index in the array easyTabSelectors
currentEasyTab = 0;

// create your flexslider
$("#flexslider-container").flexslider({

  //Put all your other flexslider config stuff here

  // bind to the 'end' callback
  end: function () {
    currentEasyTab++; // increment the currentEasyTab variable

    // if the currentEasyTab is now a tab too far, start over
    if (currentEasyTab = easyTabSelectors.length)
      currentEasyTab = 0;

    // use the easytab 'select' method to select the next tab using the array and reference
    $('#easy-tab-container').easytabs('select', easyTabSelectors[currentEasyTab]);
  }
});

如果您正在寻找在该点也停止循环播放的幻灯片,您也可以这样做。Flexslider 有很多方法和回调可以使用。

参考: - flexslider 文档/高级/所有可用的 FlexSlider 属性:http ://www.woothemes.com/flexslider/ - 选择选项卡的easytabs公共方法:http: //os.alfajango.com/easytabs/#public-methods

于 2013-04-11T16:52:08.777 回答