Reputation: 113
I have a div with multiple objects inside, images, letters, ect. how do I move them separately? right now they just move together in the same direction when I apply offset() to the class.
and another question, how do you write a loop so that you can have an arbitrary number of items inside the same div?
thanks!
<div class="toMove">
A
B
C
</div>
$('.toMove').offset( {left:5 , top: 5} );
this moves all of them, how can i move them to different locations? what if I want to create an arbitrary number of letters to move around to different locations?
Upvotes: 0
Views: 476
Reputation: 942
The only way to move elements with dependency, it's so wrap each one in different HTML elements. For an example, if you want to move the word "HELLO", letter by letter, you should wrap like that:
<span>H</span>
<span>E</span>
<span>L</span>
<span>L</span>
<span>O</span>
Then you can treat the effects as you want. I can say that it is not easy, and it depends on the desired effect.
Upvotes: 1
Reputation: 92993
Don't apply offset()
to the entire class; apply it to each individual item by ID.
Your second question makes no sense to me. Please clarify exactly what you mean, preferably with a code sample.
Upvotes: 1