Home  >  Article  >  Web Front-end  >  Relative parent element and relative document positioning sample code for jquery_jquery

Relative parent element and relative document positioning sample code for jquery_jquery

WBOY
WBOYOriginal
2016-05-16 17:27:00956browse

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

Statement:
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