+ 1

How do I get the amount of pixels a relative element is from the left side of the screen?

So I'm trying to make an element go over another, but the element is in constant motion, so I need to know how to constantly put an element over it.

12th Mar 2020, 4:20 AM
DatMADScripter
DatMADScripter - avatar
3 Réponses
+ 1
Oh I just realised I forgot I fixed it. Nothing a quick extra <did> couldn't handle
14th Mar 2020, 2:29 AM
DatMADScripter
DatMADScripter - avatar
+ 1
What you could do, after a bit of research is using an elemen't getBoundingClientRect().left attribute. Here's an example of it: var elem = document.getElementById("elem"); var rect = elem.getBoundingClientRect(); var x = rect.left; var y = rect.top;
12th Mar 2020, 5:44 AM
coddy
coddy - avatar
+ 1
With jquery, $(elem).scrollLeft() does the trick.
12th Mar 2020, 6:55 AM
Ore
Ore - avatar