2017-10-05 140 views
0

我想,当我拖过我的div中向下滚动页面,停止滚动动画不起作用?

$('#scroll-handle-down').on('dragover', function() { 

    console.log('we hovered'); 
    $('html, body').animate({ 
     scrollTop: height 
    }, 10000); 
}); 
$('#scroll-handle-down').on('dragleave', function() { 
    console.log("left") 
    $('html, body').stop().animate(); 
}); 

在拖过我设置滚动动画,但是当我走出该分区的,其继续滚动,

我想停止滚动时,我不在特定的div。

我该如何停止dralayave事件中的滚动动画?

回答

0

使用

$('html, body').stop(); 

或者

$('html, body').animate().stop();