280px here= a.height/200px parentBox.padding-top/30px parentBox.margin-top/40px innerBox.margin-top/10px;
//If the parentBox here sets position : relative; innerBox sets position: absolute; and innerBox sets top: 40px;
//At this time, the value of _offsetTop is 290px = a.height/200px parentBox.margin-top/40px innerBox.margin-top/10px ineBox.top/40px;
//Because the absolute definition is based on the inner border of the upper left corner of the parent div as the reference coordinate.
(2) jqury.position().top /left is used to get the distance between the child div and the parent div, and the child The div must be absolutely positioned
< ;div class="a"> a
$(function(){
var_offsetTop = $(".innerBox").offset().top; //280px
})
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn