小编cod*_*hMe的帖子

JavaScript scrollTop 不适用于移动设备

我正在尝试开发应用程序,但遇到了问题。您知道像 Apple 的快捷方式或 Cydia 这样的真实应用程序,当您滚动它们时,它们都会对顶部的标题产生影响,我在这里有两个示例:https : //streamable.com/j5yu5

我正在尝试做同样的事情,它可以在计算机上运行,​​但不能在我的手机上运行(iPhone 7+,运行 iOS 12.1.1,越狱,尝试全屏 safari,webclip)

这是我现在的代码:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Adam Izgin</title>
	<script src="http://koda.nu/arkivet/94004581"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
	<style>

		* {
			font-family: Chalkboard SE;
		}

		html, body {
			background: #fff;
			scroll-behavior: smooth;
		}

		body {
			height: 150vh;
		}
		
		#header {
			width: 100vw;
			height: 50px;
			background: #fff;
			position: fixed;
			top: 0;
			left: 0;
		}

		#title {
			font-size: 20px;
			font-weight: 900;
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
			opacity: 0;
			transition: …
Run Code Online (Sandbox Code Playgroud)

javascript jquery frameworks scrolltop

5
推荐指数
1
解决办法
2300
查看次数

标签 统计

frameworks ×1

javascript ×1

jquery ×1

scrolltop ×1