Javascript 如何在鼠标上方暂停滚动

Javascript 如何在鼠标上方暂停滚动,javascript,jquery,Javascript,Jquery,这里我放了一个自动上下滚动图像的代码,但我需要减慢速度并暂停鼠标上的滚动。请帮助我解决我的问题。样式标记用于设置背景和内部图像的样式 <p id="i">Hello Weaver!</p> <!-- End your code here --> </body> 要调用背景图像和内部图像: <img src="images/webdesign/pixo-mob.png" alt=""> </fig

这里我放了一个自动上下滚动图像的代码,但我需要减慢速度并暂停鼠标上的滚动。请帮助我解决我的问题。样式标记用于设置背景和内部图像的样式

<p id="i">Hello Weaver!</p>

<!-- End your code here -->
</body>
要调用背景图像和内部图像:

          <img src="images/webdesign/pixo-mob.png" alt="">  
    </figure>
  </div>
</div>
</div>
<script>
  $(function () {
    var $image = $('#image-autoscroll').children('img');
    function animate_img() {
      if ($image.css('top') == '0px') {
      $image.animate({top: -($image.height()-485)+"px"}, $image.height()*5,     function () {
        animate_img();
      });
     } else {
       $image.animate({top: '0px'}, $image.height()*5, function () {
         animate_img();
       });
     }
   }
   animate_img();
  });
</script>


<style>
  .phone-style .phone {
    background: url(../images/webdesign/phone.png) no-repeat;
    max-width: 283px;
    width: 100%;
    background-size: 100%;
    height: 471px;
    margin: 0 auto;
    overflow: hidden;
    padding: 84px 41px 99px 32px;
  }

  .phone-style .macbook, .phone-style .phone, .phone-style .tablt {
    z-index: 9999;
    cursor: not-allowed;
    box-sizing: border-box;
  }

  .phone-style .device {
    width: 100%;
    height: 100%;
  }

  .phone-style #filter, .phone-style .device {
    display: block;
    overflow: hidden;
  }

  #image-autoscroll > img {
    position : relative;
  }
<p id="i">Hello Weaver!</p>

<!-- End your code here -->
</body>

$(函数(){
var$image=$('#image autoscroll')。children('img');
函数animate_img(){
如果($image.css('top')=='0px'){
$image.animate({top:-($image.height()-485)+“px”},$image.height()*5,函数(){
设置_img()的动画;
});
}否则{
$image.animate({top:'0px'},$image.height()*5,函数(){
设置_img()的动画;
});
}
}
设置_img()的动画;
});
.电话风格.电话{
背景:url(../images/webdesign/phone.png)不重复;
最大宽度:283px;
宽度:100%;
背景大小:100%;
身高:471px;
保证金:0自动;
溢出:隐藏;
填充:84px 41px 99px 32px;
}
.phone style.macbook.phone style.phone.phone.phone.style.tablt{
z指数:9999;
光标:不允许;
框大小:边框框;
}
.手机风格.设备{
宽度:100%;
身高:100%;
}
.phone-style#过滤器、.phone-style.device{
显示:块;
溢出:隐藏;
}
#图像自动滚动>img{
位置:相对位置;
}

我发现了一种可以让你暂停的东西,但它会无限下降,一旦暂停,就不会再继续

    var yPos = 0;
var pic = $('#i');
var m = setInterval(function() {
    $('#i').css({
        'position': 'absolute',
        'top': yPos
    })
    yPos++;
  pic.mouseover(function() {
    clearInterval(m)
})
pic.mouseleave(function() {
    setInterval($('#i').css({
        'position': 'absolute',
        'top': yPos
    })
    yPos+=0.5;, 75)
})
}, 75)
<p id="i">Hello Weaver!</p>

<!-- End your code here -->
</body>

<p id="i">Hello Weaver!</p>

<!-- End your code here -->
</body>
你好,韦弗

<p id="i">Hello Weaver!</p>

<!-- End your code here -->
</body>

对于html

显示您的html或创建JSFIDLE。我们会更容易帮助你。
<p id="i">Hello Weaver!</p>

<!-- End your code here -->
</body>