Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在Prototype UI中将循环滚动添加到我的旋转木马_Javascript_User Interface_Prototypejs - Fatal编程技术网

Javascript 在Prototype UI中将循环滚动添加到我的旋转木马

Javascript 在Prototype UI中将循环滚动添加到我的旋转木马,javascript,user-interface,prototypejs,Javascript,User Interface,Prototypejs,我有一个旋转木马,滚动很好,但是当它到达内容的末尾()时,它就停止了。我想从头再来 这里是我的代码,我已经蹒跚在一起,不好用JavaScript等 <script type="text/javascript"> function startscroll() { x = window.setInterval(function scroll() { hCarousel.scrollTo(hCarousel.currentIndex() + 3); },3

我有一个旋转木马,滚动很好,但是当它到达内容的末尾(
  • )时,它就停止了。我想从头再来

    这里是我的代码,我已经蹒跚在一起,不好用JavaScript等

    <script type="text/javascript">
    
    function startscroll() {
        x = window.setInterval(function scroll() {
            hCarousel.scrollTo(hCarousel.currentIndex() + 3);
        },3000);
    }
    
    function stopscroll() {
        window.clearInterval(x);
    }
    
    function runTest() {
        hCarousel = new UI.Carousel("horizontal_carousel", {direction: "horizontal"});
        startscroll();
        $('horizontal_carousel').observe('mouseover', stopscroll);
        $('horizontal_carousel').observe('mouseout', startscroll);
    }
    
    Event.observe(window, "load", runTest);
    
    </script>
    
    
    函数startscroll(){
    x=window.setInterval(函数滚动(){
    hCarousel.scrollTo(hCarousel.currentIndex()+3);
    },3000);
    }
    函数stopscroll(){
    窗口。清除间隔(x);
    }
    函数runTest(){
    hCarousel=newui.Carousel(“水平旋转木马”{方向:“水平”});
    startscroll();
    $(“水平旋转木马”)。观察('mouseover',停止滚动);
    $('horizontal_carousel')。观察('mouseout',startscroll);
    }
    观察事件(窗口“加载”,运行测试);
    
    谢谢你的帮助 戴夫。

    改变这个

    $('horizontal_carousel')。观察('mouseover',stopscroll);
    $('horizontal_carousel')。观察('mouseout',startscroll)

      $('horizontal_carousel').onmouseover = function(){
    stopscroll();
    }
            $('horizontal_carousel').onmouseout = function(){
    startscroll();
    }`