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 は単純に最初に出現した ID を選択します。

使用してみてください:

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

そして、あなたの JS では、 と を混合$してjQueryいます。

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