jQuery offsetParent() 方法

jQuery 教程 · 2019-03-28 09:38:57

实例

设置 <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

查看所有标签

Thinking Recursively

Thinking Recursively

Eric S. Roberts / Wiley / 1986-1-17 / USD 85.67

The process of solving large problems by breaking them down into smaller, more simple problems that have identical forms. Thinking Recursively: A small text to solve large problems. Concentrating on t......一起来看看 《Thinking Recursively》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

SHA 加密
SHA 加密

SHA 加密工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具