Add a class to the paragraph in the javascript part:
var MONEY=0;
for(var i=1;i<=10;i++){
MONEY+=500;
$('p').addClass('anim');
$('p').html(''+MONEY);
}
the associated CSS:
p.anim{
transform:translateY(300px);<br>
transition:0.5s in all;<br>
}
$("p").change(function(){
$(this).animate({
left: '250px',
height: '+=150px',
width: '+=150px'
});
});
You could try this code. Animations can be done simpler with jQuery.
I am recently working on an animation project, just here to ask a question about it.
For Ex: I have a variable ‘MONEY’ which I have to display in <p>
tag after every operation performed on it.
Here’s a brief overview:
var MONEY=0;
for(var i=1;i<=10;i++){
MONEY+=500;
$('p').html(''+MONEY);
}
Now, My question is How do I animate <p>
tag, (i.e with some text effects, so that every time it is displayed animation should happen).
Right Now,
I have added animation to
like below:-
p{
//some animation
}
but this doesn’t work, Any help?
What kind of animation are you trying to do? Count up animation? And can you post your animation code?
Thanks for your answer, but I m afraid to say that it just doesn’t work.
It would be helpful if you could just paste a link to JSFiddle.