offset() and position() of jQuery
Language
2023-09-06 02:55:08
views: null
1. offset()
- Get the position of the element from the left and top of the document
- What is obtained is an object, and there are two attributes top and left in the object
$('div').offset()
Two, position ()
- What is obtained is the position of the element from the positioned parent element
- The acquisition will get an object, which has two attributes top and left
$('div').position()
Origin blog.csdn.net/qq_52421092/article/details/131259333