Find html element nearest to position (relative or absolute)

后端 未结 5 1828
隐瞒了意图╮
隐瞒了意图╮ 2020-12-10 01:52

Given absolute or relative position (top & left) is there any way to get the nearest html element to these co-ordinates?

Or alternately, is there any way to craf

5条回答
  •  余生分开走
    2020-12-10 02:05

    Or try the original jQuery function offsetparent(). From this page comes the next example:

    $( "li.item-a" ).offsetParent().css( "background-color", "red" );
    

提交回复
热议问题