How to determine position (x,y) relative to the page of every character inside spans through javascript?
Posted
by
Fernando
on Stack Overflow
See other posts from Stack Overflow
or by Fernando
Published on 2012-07-07T03:12:41Z
Indexed on
2012/07/07
3:15 UTC
Read the original article
Hit count: 272
This is as simple as I can get.
I will have several spans randomly positioned on the screen through something like:
$(".hidden:first").css('-webkit-transform','rotate('+((0.5-Math.random())*40)+'deg)');
$(".hidden:first").animate({
left: '+=' + (((screen.width-800-224)/2) + Math.random()*800),
top: '+=' + (50+Math.random()*600)
} [...]
and later on I would like to iterate through every char of every of those elements (that are randomly position and have random rotation), and I would need to discover the (x,y) position of every character on the screen so I can colorize it, forming certain draws according to certain functions.
Is this easily achievable? I am really inexperienced at javascript.
Thanks. Fernando.
© Stack Overflow or respective owner