防止jquery中的默认鼠标滚动 [英] Preventing default mouse scrolling in jquery

查看:108
本文介绍了防止jquery中的默认鼠标滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试构建自己的滑块,但我想知道如何阻止页面在特定div上滚动。



I尝试使用以下代码:



I am currently trying to build my own slider, but I would like to know how to prevent the page from scrolling when am over a particular div.

I tried using the codes below :

$(document).ready(function () {
   $("#tracks").mouseenter(function (e) {
     e.preventDefault();
     e.stopPropagation();
     onNavigate();
    });
  });





onNavigate()方法应该向上和向下移动滚动条,但是鼠标的默认操作阻止我执行操作的代码。感谢您的常规帮助。



The onNavigate() method is supposed to move the scroll bar up and down, but the default operation of the mouse is preventing me the code from performing the operation. Thanks for usual help.

推荐答案

document )。ready( function (){
(document).ready(function () {


#tracks )。mouseenter( function (e){
e.preventDefault();
e.stopPropagation();
onNavigate();
});
});
("#tracks").mouseenter(function (e) { e.preventDefault(); e.stopPropagation(); onNavigate(); }); });





onNavigate()方法应该是向上和向下移动滚动条,但鼠标的默认操作阻止我执行操作的代码。感谢您的常规帮助。



The onNavigate() method is supposed to move the scroll bar up and down, but the default operation of the mouse is preventing me the code from performing the operation. Thanks for usual help.


可以通过以下链接为您提供帮助,



http://stackoverflow.com/questions/4770025/how-to-disable-scrolling-temporarily [ ^ ]
May this following link will help you,

http://stackoverflow.com/questions/4770025/how-to-disable-scrolling-temporarily[^]


这篇关于防止jquery中的默认鼠标滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆