Adelson6789 Adelson6789 - 1 year ago 67
Javascript Question

Put a text in side of jquery animation

I found this post Animate like button when click on it, but I want to know how I can put a text side of animation.

I tried:

<div class="heart">TEXT</div>


<div class="heart"><p>TEXT</p></div>

But the text come over the animation...
I just want the text in right side of animation.
How to make this ?

Answer Source

Here is an updated snippet base on the fiddle you are trying to do.

$(".heart").on('click touchstart', function(){

$(".heart").on('animationend', function(){
.heart {
  margin-top: -1em;
  cursor: pointer;
  height: 50px;
  width: 50px;
  background-image:url(  '');
  background-position: left;

 .heart:hover {

 .animating {
  animation: heart-burst .8s steps(28) 1;

 @keyframes heart-burst {
 from {background-position:left;}
 to { background-position:righ;}
<div class="heart-container">
  <div class="heart"></div>

<script src=""></script>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download