gpt4 book ai didi

iphone - 在 iPhone 网站上禁用水平滚动

转载 作者:IT王子 更新时间:2023-10-29 08:14:36 25 4
gpt4 key购买 nike

我正在开发 Wordpress 驱动网站的 iPhone 版本,我想知道当网站在 iPhone 的 Safari 中打开时是否有任何方法可以禁用水平滚动。现在,我的开发已经进行到一半,只是为了检查是否可以禁用水平滚动,我已经隐藏了任何超过屏幕宽度但仍然可以向右水平滚动的元素。我尝试将以下代码放入 <style> <head> 中的标签但这没有帮助:

body { overflow-x: hidden; }

我已经把下面的 <meta>如果用户正在通过 iPhone 查看网站,则头文件中的代码会回显,但它只会禁用用户捏合,即您无法通过捏合屏幕来放大和缩小。

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

我目前正在使用 iPhone 4 查看该网站,可以通过以下链接访问该网站:http://ignoremusic.com .期待你们的解决方案,谢谢。

SOLUTION: As suggested by @Riskbreaker, there were a few elements which were exceeding the width of ~312px which is why I could still swipe to the left and after adjusting the width of all such elements, I disabled horizontal swipe. One thing which I learned is that hiding overflow-x doesn't help in the case of an iPhone/iPad, you have to reduce the width of all the elements to that of the width of your screen otherwise you'll still be able to swipe horizontally.

最佳答案

我知道我来晚了一点,但我遇到了同样的问题并通过添加解决了它:

body, html{
overflow-x: hidden;
}

希望这对其他人有帮助!

关于iphone - 在 iPhone 网站上禁用水平滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15879710/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com