滚动条经常出现,当我将鼠标移到某些特定的Div上时 [英] Scroll Bar Is Coming Often , While I Mouse Over On Some Specific Divs

查看:67
本文介绍了滚动条经常出现,当我将鼠标移到某些特定的Div上时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



滚动条经常出现,而我鼠标悬停在一些特定的div上,但我已经检查过其他屏幕没有问题,因为我看到了,所以任何人都可以帮我解决这个问题



提前谢谢



Velsamy

Dear all,

scroll bar is coming often , while i mouse over on some specific div, but i have checked with other screens there is no problem as i seen, so anyone could help me to solve this

thanks in advance

Velsamy

推荐答案

您遇到的问题是与样式相关的问题。当您将鼠标悬停在某个元素上时,该元素会获得更多边框或填充或边距。这会导致其大小发生变化。在这种情况下,它的大小会放大,导致滚动条出现。



有一些黑客为此,第一个是确保身体元素总是占用屏幕的一部分,像这样



The problem that you're having is a style related issue. When you hover over to some element, the element gets some more borders or paddings or margins. Which causes its size to be changed. In this case, its size enlarges causing the scroll bar to come out.

There are some hacks for this, first one is to make sure the body element always takes up a part of the screen, like this

// set the body's height to be the 100 less than the screen's height..
document.getElementById("body").style.height = screen.height - 100;





..或者你可以使用CSS解决这个问题,你可以确保在任何悬停事件(鼠标悬停)上对象的大小不会改变。



..or you can use the CSS to tackle this, and you can make sure that upon any hover event (mouse over) the size of the objects don't change.


这篇关于滚动条经常出现,当我将鼠标移到某些特定的Div上时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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