我的印象$('body').offset().top应该是回归0,但显然它会不断回归8.我从网页上删除了所有不必要的代码,但仍然会返回8.
这是我有的:
<!DOCTYPE html>
<html lang="en">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<script>
$(document).ready(function () {
console.log($('body').offset().top);
})
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这就是我的代码中的所有内容.这是JSFiddle:http://jsfiddle.net/Lspkx2su/