【发布时间】:2012-04-13 21:06:40
【问题描述】:
我正在使用 jquery mobile 构建一个移动 webapp。现在我想做一个回到顶部的动作。 通常你应该像下面的代码那样做。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Body ID For Top Anchor Demo</title>
</head>
<!-- NOTICE: ID in Body Tag. -->
<body id="top">
<h1>
This Is My Demo
</h1>
<p style="margin-bottom: 3000px ;">
This paragraph has a huge ass bottom margin
so that the page will definitely scoll and
put the following link below the page fold.
</p>
<p>
<!--
This link will jump back up to the ID:top in
the document. Since that is the ID of the body
tag, this link will jump to the top of the page.
-->
<a href="#top">Back To Top</a>
</p>
</body>
</html>
但是#在jquery mobile中用于链接内部页面,所以上面的方法不起作用。有人知道如何正确执行此操作吗?
亲切的问候。
【问题讨论】:
标签: jquery html css jquery-mobile anchor