How to get the location coordinates of the specified element from the page in Mini Program

for example, if you click an icon on the page, do you want to get the position of the current icon from the screen?

in Mini Program"s event object, there are currentTarget.offsetLeft and currentTarget.offsetTop , but this is the offset of the current component of the event binding from the parent container ( target.offsetLeft similar)

there are detail.x and detail.y , but this is the coordinate of the hot spot, which means, for example, if you click on the upper left corner and the lower right corner of the icon, then the two coordinates are not the same.


https://developers.weixin.qq.

An API similar to getting a DOM location should meet your requirements

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9be27-47665.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9be27-47665.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?