jQuery position() 方法

jQuery 教程 · 2019-03-27 16:13:28

实例

返回 <p> 元素的 top 和 left 位置:

$("button").click(function(){ x=$("p").position(); alert("Top: " + x.top + " Left: " + x.left); });

定义和用法

position() 方法返回第一个匹配元素的位置(相对于它的父元素)。

该方法返回一个带有两个属性(以像素为单位的 top 和 left 位置)的对象。

语法

$(selector).position()

点击查看所有 jQuery 教程 文章: https://www.codercto.com/courses/l/35.html

查看所有标签

Hatching Twitter

Hatching Twitter

Nick Bilton / Portfolio Hardcover / 2013-11-5 / USD 28.95

The dramatic, unlikely story behind the founding of Twitter, by New York Times bestselling author and Vanity Fair special correspondent The San Francisco-based technology company Twitter has become......一起来看看 《Hatching Twitter》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具