Posteo un par de funciones para saber la posición absoluta (x,y) de un objeto en Javascript:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | function getX( oElement ) { var iReturnValue = 0; while( oElement != null ) { iReturnValue += oElement.offsetLeft; oElement = oElement.offsetParent; } return iReturnValue; } function getY( oElement ) { var iReturnValue = 0; while( oElement != null ) { iReturnValue += oElement.offsetTop; oElement = oElement.offsetParent; } return iReturnValue; } |
Encontré la función getY en este foro.
Con estas funciones podremos saber la posición de los objetos con respecto a la ventana del navegador.
Gracias, funciona perfecto.
I found your this post while searching for some related information on blog search…Its a good post.Rio Julio Pena Blazer
Your post content is being interested by a lot of people, I am very impressed with your post. I hope to receive more good articles.
Yellowstone Season 5 Ryan Jacket
Great information, I will recommend it to my friends for them to check out. Thanks for sharing! If you have more time, please visit: trap the cat
That article is well written. Don’t stop making changes to your blog five nights at freddy’s