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
JavaScript and Ajax for the Web, Sixth Edition
Tom Negrino、Dori Smith / Peachpit Press / August 28, 2006 / $24.99
Book Description Need to learn JavaScript fast? This best-selling reference’s visual format and step-by-step, task-based instructions will have you up and running with JavaScript in no time. In thi......一起来看看 《JavaScript and Ajax for the Web, Sixth Edition》 这本书的介绍吧!