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://www.codercto.com/courses/l/35.html

查看所有标签

Web 2.0 Architectures

Web 2.0 Architectures

Duane Nickull、Dion Hinchcliffe、James Governor / O'Reilly / 2009 / USD 34.99

The "Web 2.0" phenomena has become more pervasive than ever before. It is impacting the very fabric of our society and presents opportunities for those with knowledge. The individuals who understand t......一起来看看 《Web 2.0 Architectures》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

MD5 加密
MD5 加密

MD5 加密工具