jQuery offsetParent() 方法

jQuery 教程 · 2019-03-27 15:29:28

实例

设置 <p> 元素的最近定位的祖先元素的背景颜色:

$("button").click(function(){ $("p").offsetParent().css("background-color","red"); });

定义和用法

offsetParent() 方法返回第一个定位的祖先元素。

提示:通过 jQuery 或 CSS 的 position 属性(relative、absolute 或 fixed)对元素进行定位。

语法

$(selector).offsetParent()

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

查看所有标签

Programming Python

Programming Python

Mark Lutz / O'Reilly Media / 2006-8-30 / USD 59.99

Already the industry standard for Python users, "Programming Python" from O'Reilly just got even better. This third edition has been updated to reflect current best practices and the abundance of chan......一起来看看 《Programming Python》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具