我怎样才能阻止用户水平拖动页面? [英] how can i stop users from dragging a page horizontally?
问题描述
我的页面有一个水平滚动功能,当按下按钮时,包含滚动内容的DIV动画到左侧。
该元素的宽度为18000px ,所以它有一个水平滚动条,我禁用。
然而,我仍然可以拖动我的页面左右,我想阻止用户这样做。有没有解决我的问题的CSS?感谢您的时间
我想用 overflow:hidden
DIV并使用javascript来控制 margin-left
左右移动将完成任务
编辑添加示例:
<! - Frame - >
< div class =containerstyle =width:1024px; overflow:hidden>
< div class =very-long-divstyle =width:18000px>
您的真棒内容在这里
< / div>
< / div>
My page has a horizontal scroll feature, and when a button is pressed the DIV containing the scrolling content animates to the left.
The width of that element is 18000px, so it has a horizontal scrollbar that I disabled.
However I could still drag my page left and right and I would like to stop users doing that. Is there a css solution to my problem? Thanks for your time
I suppose using overflow:hidden
on the DIV and use javascript to control the margin-left
to shift left and right will do the job
Edit Add example:
<!-- The "Frame" -->
<div class="container" style="width:1024px;overflow:hidden">
<div class="very-long-div" style="width:18000px">
Your awesome content here
</div>
</div>
这篇关于我怎样才能阻止用户水平拖动页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!