0

基本上我想在不同的选项卡中添加不同的轮播......下面是我的源代码......它失败并且不显示选项卡和轮播..我哪里出错了..下面是我的代码,我包括了jquery和 HTML .. 谢谢!

    <script type="text/javascript">

jQuery(document).ready(function() {
    jQuery('.mycarousel').jcarousel();
    $( "#tabs" ).tabs();
});

</script>
</head>
<body>
    <div id="tabs">
      <ul>
        <li><a href="#tabs-1">Carousel One display First Tab</a></li>
        <li><a href="#tabs-2">Carousel Two display Second Tab</a></li>
      </ul>

    <!-- Start of First tab -->

         <div id="tabs-1">
          <ul class="mycarousel" class="jcarousel-skin-tango">
            <li><img src="http://static.flickr.com/66/199481236_dc98b5abb3_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/75/199481072_b4a0d09597_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/57/199481087_33ae73a8de_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/77/199481108_4359e6b971_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/58/199481143_3c148d9dd3_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/72/199481203_ad4cdcf109_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/58/199481218_264ce20da0_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/69/199481255_fdfe885f87_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/60/199480111_87d4cb3e38_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/70/229228324_08223b70fa_s.jpg" width="75" height="75" alt="" /></li>
          </ul>
    </div>

    <!-- Start of Second tab -->
    <div id="tabs-2">
          <ul class ="mycarousel" class="jcarousel-skin-tango">
            <li><img src="http://static.flickr.com/66/199481236_dc98b5abb3_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/75/199481072_b4a0d09597_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/57/199481087_33ae73a8de_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/77/199481108_4359e6b971_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/58/199481143_3c148d9dd3_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/72/199481203_ad4cdcf109_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/58/199481218_264ce20da0_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/69/199481255_fdfe885f87_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/60/199480111_87d4cb3e38_s.jpg" width="75" height="75" alt="" /></li>
            <li><img src="http://static.flickr.com/70/229228324_08223b70fa_s.jpg" width="75" height="75" alt="" /></li>
          </ul>
    </div>  <!-- end of second tab -->


    </div> <!-- End div of tabs -->

</body>
</html>
4

1 回答 1

1

您有多个 ID“mycarousel”实例。请记住,ID 必须是唯一的 - 如果同一页面上有多个 ID,则无法预测浏览器的行为,但通常 jQuery 会简单地选择第一个出现的位置。

尝试使用:

<ul class="mycarousel jcarousel-skin-tango">...</ul>

对于您的 JS,您正在混合$jQuery.

jQuery(document).ready(function($) {
    $('.mycarousel').jcarousel();
    $( "#tabs" ).tabs();
});
于 2013-11-10T01:05:35.203 回答