Home >Web Front-end >JS Tutorial >Relative parent element and relative document positioning sample code for jquery_jquery
Positioning is often used when developing jquery. Here are two types of positioning:
1. Positioning relative to the parent element: $("#ele").position(), and then get left = $("#ele ").postion().left right = $("#ele").postion().right
2. Relative document positioning: $("#ele").offset(), and then get left = $( "#ele").offset().left right = $("#ele").offset().right