<bdo id='z9Jly'></bdo><ul id='z9Jly'></ul>
<i id='z9Jly'><tr id='z9Jly'><dt id='z9Jly'><q id='z9Jly'><span id='z9Jly'><b id='z9Jly'><form id='z9Jly'><ins id='z9Jly'></ins><ul id='z9Jly'></ul><sub id='z9Jly'></sub></form><legend id='z9Jly'></legend><bdo id='z9Jly'><pre id='z9Jly'><center id='z9Jly'></center></pre></bdo></b><th id='z9Jly'></th></span></q></dt></tr></i><div id='z9Jly'><tfoot id='z9Jly'></tfoot><dl id='z9Jly'><fieldset id='z9Jly'></fieldset></dl></div>
  • <small id='z9Jly'></small><noframes id='z9Jly'>

      1. <tfoot id='z9Jly'></tfoot>
      2. <legend id='z9Jly'><style id='z9Jly'><dir id='z9Jly'><q id='z9Jly'></q></dir></style></legend>

        如何防止鼠标在悬停元素之外滚动?

        How to prevent mouse scrolling outside hovered element?(如何防止鼠标在悬停元素之外滚动?)

        <small id='jtEX9'></small><noframes id='jtEX9'>

              <tbody id='jtEX9'></tbody>

              <tfoot id='jtEX9'></tfoot><legend id='jtEX9'><style id='jtEX9'><dir id='jtEX9'><q id='jtEX9'></q></dir></style></legend>

              <i id='jtEX9'><tr id='jtEX9'><dt id='jtEX9'><q id='jtEX9'><span id='jtEX9'><b id='jtEX9'><form id='jtEX9'><ins id='jtEX9'></ins><ul id='jtEX9'></ul><sub id='jtEX9'></sub></form><legend id='jtEX9'></legend><bdo id='jtEX9'><pre id='jtEX9'><center id='jtEX9'></center></pre></bdo></b><th id='jtEX9'></th></span></q></dt></tr></i><div id='jtEX9'><tfoot id='jtEX9'></tfoot><dl id='jtEX9'><fieldset id='jtEX9'></fieldset></dl></div>
                <bdo id='jtEX9'></bdo><ul id='jtEX9'></ul>
                  本文介绍了如何防止鼠标在悬停元素之外滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个设置为溢出的 div:scroll;.我得到了我想要的滚动条.但是,当使用鼠标滚轮滚动 div 时,它会在到达 div 内容的顶部或底部时滚动页面的其余部分.

                  I have a div which is set to overflow:scroll;. I get scrollbars which is what I want. However when scrolling the div with the mousewheel it scrolls the rest of the page when it reaches the top or bottom of the div's content.

                  如何根据悬停的内容仅滚动 div 或整个页面?

                  How can I scroll only the div or the entire page based on what's hovered ?

                  推荐答案

                  首先我不认为你可以覆盖滚动事件.所以这就是我要做的.我不知道 jquery,但这里有一些直接的 javascript.

                  First I don't think you can override the scroll event. So here is what I would do. I don't know jquery but here is some straight javascript.

                  document.getElementById('scrollDiv').onmouseover=function(){
                    document.getElementByTagName('body')[0].style.overflow='hidden';
                  }
                  document.getElementById('scrollDiv').onmouseout=function(){
                    document.getElementByTagName('body')[0].style.overflow='';
                  }
                  

                  显然你可以稍微调整一下,但这是基本的想法.此外,如果您需要,您可以执行其他测试用例.就像如果 div 有焦点然后做同样的事情.取决于您的设置.

                  Obviously you could tweak this a little, but this is the basic idea. Also, if you need to you could do other test cases. Like if the div has focus then do the same thing. Depends on your setup.

                  这篇关于如何防止鼠标在悬停元素之外滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)

                    <tbody id='H1zGE'></tbody>

                    <bdo id='H1zGE'></bdo><ul id='H1zGE'></ul>
                    • <tfoot id='H1zGE'></tfoot>

                          <i id='H1zGE'><tr id='H1zGE'><dt id='H1zGE'><q id='H1zGE'><span id='H1zGE'><b id='H1zGE'><form id='H1zGE'><ins id='H1zGE'></ins><ul id='H1zGE'></ul><sub id='H1zGE'></sub></form><legend id='H1zGE'></legend><bdo id='H1zGE'><pre id='H1zGE'><center id='H1zGE'></center></pre></bdo></b><th id='H1zGE'></th></span></q></dt></tr></i><div id='H1zGE'><tfoot id='H1zGE'></tfoot><dl id='H1zGE'><fieldset id='H1zGE'></fieldset></dl></div>
                        • <legend id='H1zGE'><style id='H1zGE'><dir id='H1zGE'><q id='H1zGE'></q></dir></style></legend>

                        • <small id='H1zGE'></small><noframes id='H1zGE'>