【问题标题】:why 'overflow' is not working correctly on mobile?为什么“溢出”在移动设备上无法正常工作?
【发布时间】:2022-01-04 08:17:27
【问题描述】:

我在使用触摸滚动时出现问题,使用鼠标和键盘箭头可以正常工作,但不能通过触摸。 这是html代码:

<div class="drive-dashboard">
   <div id="dashboardContainer" class="dashboard-container"/>
</div>

这是 CSS 部分

.drive-dashboard {
   height: 100%;
   width: 100%;
   position: absolute;
   overflow: auto;
}

有什么建议吗?

【问题讨论】:

    标签: html css google-chrome-devtools


    【解决方案1】:

    我之前遇到过这个问题,在 React 中我已经能够通过以下方式解决它:

    `document.addEventListener("touchstart", function() {}, true);`
    

    但是,我不得不承认有时我需要使用它,有时不需要,所以我不确定哪些 html 元素会响应,哪些不会。

    Here is some reference

    【讨论】:

    • 感谢您的回答。当我禁用 javascript 时,一切都正常工作的奇怪部分
    猜你喜欢
    • 2021-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-02
    • 1970-01-01
    • 1970-01-01
    • 2018-04-28
    • 1970-01-01
    相关资源
    最近更新 更多