0

ローカル環境とテスト環境にjquerysimple-carouselを実装していて、完全に機能しますが、本番環境に移動すると、コンソールエラーがスローされます。スクリプトはここにあります。

これは私が受け取っているエラーです:

TypeError:$( "ul.carousel")。simplecarouselは関数ではありません

私は周りを見回していて、役に立たない古い投稿を除いて、この問題に関連するものを見つけることができません。ここに見られるように、私は非常に基本的な実装を使用しています

どんな助けでも大歓迎です。私は約4つの異なるスライダーパッケージを試しましたが無駄になりました。同様のエラーが発生し続けます。

これが私のコードです:

    <style>
    ul.carousel {padding:0;margin:0;}
    #carousel-wrap {width:790px;height:565px;}
    #carousel-wrap span.next {
        position:absolute;
        top:15%;
        right:170px;
        z-index:999;
        width: 28px;
        height: 80px;
        text-indent: -999999px;
        background: url(http://www.3balls.com/images/homepage/ed_next.png) no-repeat 4px 0px;
        cursor:pointer;
    }
    #carousel-wrap span.prev {
        position:absolute;
        top:15%;
        left:0;
        z-index:999;
        width: 28px;
        height: 80px;
        text-indent: -999999px;
        background: url(http://www.3balls.com/images/homepage/ed_prev.png) no-repeat -4px 0px;
        cursor:pointer;
    }
    </style>


    <script type="text/javascript">
        jQuery(document).ready(function() {
            $("ul.carousel").simplecarousel({
                width:790,
                height:565,     
                auto: 4000,
                next: $('.next'),
                prev: $('.prev')
            });
        });    
    </script>

    <div id="carousel-wrap">
    <ul class="carousel">
      <li><img src="http://www.3balls.com/images/homepage/ads/ad_fallingprices.png" alt="Main Feature" usemap="#Map6" border="0" /></li>
      <li><img src="http://www.3balls.com/images/homepage/ads/ad_fallingprices.png" alt="Main Feature" usemap="#Map5" border="0" /></li>
      <li><img src="http://www.3balls.com/images/homepage/ads/ad_fallingprices.png" alt="Main Feature" usemap="#Map4" border="0" /></li>
    </ul>
    <span class="prev">prev</span>
    <span class="next">next</span> 
    </div>
4

2 に答える 2

2

これを試して:

<script type="text/javascript">
    var $jq = jQuery.noConflict();
    $jq(document).ready(function() {
        $jq("ul.carousel").simplecarousel({
            width:790,
            height:565,     
            auto: 4000,
            next: $jq('.next'),
            prev: $jq('.prev')
        });
    });    
</script>
于 2012-11-05T18:30:46.260 に答える
1

$-記号を使い続けたい場合は、これを試すことができます

<script type="text/javascript">
jQuery(document).ready(function($) {
    $("ul.carousel").simplecarousel({
        width:790,
        height:565,     
        auto: 4000,
        next: $jq('.next'),
        prev: $jq('.prev')
    });
});
</script>
于 2012-11-05T18:43:06.450 に答える