+ 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.
3 Respostas
+ 1
Oh I just realised I forgot I fixed it. Nothing a quick extra <did> couldn't handle
+ 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;
+ 1
With jquery, $(elem).scrollLeft() does the trick.