silentScroll() 滚屏

时间:2022-02-22 04:26:53

jQuery.mobile.silentScroll( yPos )

滚动到一个特定的Y坐标位置,没有触发涡旋的事件监听器

yPos:Y坐标。类型:数字。默认值:
//滚屏到y 100px处
$.mobile.silentScroll();
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery.mobile.silentScroll demo</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<!-- The script below can be omitted -->
<script src="/resources/turnOffPushState.js"></script>
<script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
</head>
<body> <div data-role="page"> <div data-role="header">
<h1>silentScroll() example</h1>
</div>
<div data-role="content">
<a href="#" onclick="$.mobile.silentScroll(100)" data-role="button">Go down pixels</a>
<p> <br /><br />Here, we have some text so that we can have <br />
some vertical space in order to demonstrate <br />
the silentScroll() method.<br /><br /></p>
<a href="#" onclick="$.mobile.silentScroll(0)" data-role="button">Back to Top</a>
</div>
<div data-role="footer">
<h4> </h4>
</div> </div> </body>
</html>