【发布时间】:2016-02-11 07:11:22
【问题描述】:
以下代码是来自 w3schools 的示例。
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
var x = $("p").offset();
alert("Top: " + x.top + " Left: " + x.left);
});
});
</script>
</head>
<body>
<p>This is a paragraph.</p>
<button>Return the offset coordinates of the p element</button>
</body>
</html>
是否可以使用jquery获得右偏移和偏移底部?
链接:
【问题讨论】:
标签: javascript jquery html positioning offset