html - 无法在 iOS 中使用
问题描述
我有一个很长的网站,我正在嵌入另一个网站。以下代码适用于桌面浏览器,但不适用于平板电脑或移动设备。
在 iOS 上,当我尝试上下移动页面时,无法滚动。在桌面上,没有问题。
问题:如何更正下面的代码,以便滚动始终在任何浏览器中工作?
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
html, body, embed {
width: 100%;
height: 100%;
margin: 0;
display: block;
}
</style>
</head>
<body>
<embed src="http://www.example.com">
</body>
</html>
解决方案
我尝试使用标签在另一个页面中包含一个可滚动的网页。与您的体验相同,嵌入式页面可以在桌面上正常滚动,但在 iOS 上则不行。我切换到一个 iframe,它允许在桌面和 iOS 上滚动 iframe 内容:
<div style="overflow: auto; -webkit-overflow-scrolling: touch;height:450px;" id="my">
<iframe src="https://www.example.com" style="overflow: auto; -webkit-overflow-scrolling: touch; border: none;" scrolling="yes" width="100%" height="100%"> </iframe>
</div>
推荐阅读
- bluetooth-lowenergy - 使用 RFcommsocket 连接到蓝牙 DUAL-SPP
- c# - 从继承的类中读取文本框
- sails.js - 如何覆盖sailsjs中的所有蓝图查找操作
- java - Java 并行流产生 HashMap
- php - 我应该始终将 ignore_user_abort 设置为 true 吗?
- java - Android Java 应用程序无法通过蓝牙发送选定的文件/数据
- c# - 如何使用 Activator.CreateInstance 创建列表
哪里 T 在运行时是未知的? - python - 在 Python OOP 中实现 datetime 模块
- python - 如何将一列字符串转换为列表
- javascript - 如何在没有 JS 的情况下使用嵌套 UL 获取大型菜单?