jQuery gets the method to specify the coordinates of the element

  • 2020-05-27 04:25:44
  • OfStack

This example shows how jQuery gets the coordinates of a specified element. Share with you for your reference. The specific analysis is as follows:


var left = $("#div").offset().left;
//div The offset to the left of the window 
var top = $("#div").offset().top;
// Corresponds to the offset at the top of the window 

I hope this article has been helpful to your jQuery programming.


Related articles: