#46 jquery to js convertion changes

This commit is contained in:
Agriya Dev5
2021-02-05 17:30:31 +05:30
parent a330dfbc28
commit 2a59e75cab
4 changed files with 126 additions and 136 deletions

View File

@@ -0,0 +1,16 @@
/**
* @param {any} obj
* @returns {any}
*/
export function findPos (obj) {
let curleft = 0;
let curtop = 0;
if (obj.offsetParent) {
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
return {left: curleft, top: curtop};
}
return {left: curleft, top: curtop};
}