overflow-x时隐藏鼠标滚动:隐藏[CSS,HTML] [英] Disable mouse scroll when overflow-x: hidden [CSS,HTML]

查看:208
本文介绍了overflow-x时隐藏鼠标滚动:隐藏[CSS,HTML]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:
我的div的内容被定位为绝对,并且内容的宽度大于div。
根据需要,使用overflow-x:hidden剪切extra内容。



尽管如果我尝试使用鼠标滚轮进行水平滚动,内容就会显示出来。



我怎么不让这种情况发生?我很好,使用JS或/和CSS解决方案



例如代码

 < body width ='1000px'> 
< div style ='background-color:blue; width:1200px'> contents< / div>
< / body>

谢谢!

解决方案

 #/ b>我有同样的问题,如果你把它放在一个包装中,那么它会阻止触控板滚动。包装器(
position:absolute;
宽度:100%;
overflow-x:hidden;
}


PROBLEM: The contents of my div are positioned 'absolute' and the width of the contents are larger than the div. As required the "extra" contents are clipped using "overflow-x: hidden".

Although, if I try to horizontal scroll using the mouse-scroller, the content get visible.

How do I not let this happen ? I am fine with using a JS or/and a CSS solution

e.g code

<body width='1000px'>
  <div style='background-color: blue; width: 1200px'>contents</div>
</body>

Thanks !

解决方案

I had the same problem, if you place it within a wrapper then it prevents trackpad scrolling.

#wrapper { 
    position: absolute;
    width: 100%;
    overflow-x: hidden;
}

这篇关于overflow-x时隐藏鼠标滚动:隐藏[CSS,HTML]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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