SlidesJS - “滑动到”会破坏代码

时间:2012-02-11 23:37:28

标签: jquery

我有一个滑块,在有人播放Youtube视频之前表现正常 - 然后停止直到视频结束。视频完成后,转发到下一张幻灯片。

然而。一旦它转发到下一张幻灯片,动画就会完全停止 prev / next按钮中断。有人有修复吗?

http://adinamurch.com/vidtest.html

SlidesJS Google小组发布的修补程序对我没有任何作用。

由于

编辑:这是滑块的HTML代码(由Wordpress主题自动生成):

<div class="sText" id="textSlider"> 
    <div class="slide">
        <div class="slide-image"><img src="http://daatsolutions.info/ditto/wp-content/uploads/2012/02/slide-vid1.png" /></div>
        <div class="slide-text-right ">
            <div class="slide-title"><a href="http://daatsolutions.info/ditto/2012/01/test-2/"> Test </a></div>
            <div id="videoDiv">Loading...</div>
        </div>
        <div class="clear"></div>
    </div><!--/ .slide  -->     
    <div class="slide">
        <div class="slide-image"><img src="http://daatsolutions.info/ditto/wp-content/uploads/2011/12/frame_1.jpg" /></div>
        <div class="slide-text-right ">
            <div class="slide-title"><a href="http://daatsolutions.info/ditto/2011/12/for-lifes-assets/"> For Life&#8217;s Assets </a></div>
            <div class="slide-descr"><p><img src="http://daatsolutions.info/ditto/wp-content/uploads/2011/12/assets-text.png" alt="" title="assets-text" width="204" height="77" class="alignnone size-full wp-image-261" /></p></div>
            <div class="clear"></div>
        </div><!--/ .slide-text  -->
        <div class="clear"></div>
    </div><!--/ .slide  -->
    <div class="slide">
        <div class="slide-image"><img src="http://daatsolutions.info/ditto/wp-content/uploads/2011/12/frame_2.jpg" /></div>
        <div class="slide-text-right ">
            <div class="slide-title"><a href="http://daatsolutions.info/ditto/2011/12/second-test/"> Store things that matter </a></div>
            <div class="slide-descr"><p><img src="http://daatsolutions.info/ditto/wp-content/uploads/2011/12/store-text.png" alt="" title="store-text" width="236" height="63" class="alignnone size-full wp-image-259" /></p></div>
            <div class="clear"></div>
        </div><!--/ .slide-text  -->
        <div class="clear"></div>
    </div><!--/ .slide  -->
</div><!--/ .sText  -->

我正在使用默认的Youtube Javascript API,并对此功能进行了更改:

// This function is called when the player changes state
      function onPlayerStateChange(newState) {
        //updateHTML("playerState", newState);
        var slidestat = $("#textSlider").slides("status","state");
        var slidenum = $("#textSlider").slides("status","current");
        //alert(slidestat);
        if(slidenum>1) {
            $('#textSlider').slides("play");
        } else {
            $('#textSlider').slides("stop");
        }
        if(newState == 1) { //playing (3 is buffering)
            $('#textSlider').slides("stop");
            $("#textSlider").slides("slide",1); //compensates for slidesjs bug that goes 1 slide before stopping
        } if(newState == -1) { //unstarted
            $('#textSlider').slides("pause");
        } if((newState == 2) || (newState == 0)) { //paused or finished
            $('#textSlider').slides("play");
            $("#textSlider").slides("slide",2);
        } else {
            //$('#textSlider').slides("stop");
        }
      }

1 个答案:

答案 0 :(得分:0)

我通过使用setTimeout()(我希望它在每张幻灯片上暂停的秒数)而不是滑块的内置函数解决了这个问题。