I have a CSS element referred to as .row, which looks as follows:
@-webkit-keyframes slideright {
from { background-position: left; }
to { background-position: right; }
}
.row {
width: 200%;
height: 100px;
-webkit-animation: slide 100s linear infinite;
}
.row.row-1 {
background-image: url(row/1.png);
-webkit-animation-name: slideright;
}
I want to change the animation speed (100s) using javascript or JQuery, to dynamic values. So I tried this:
$('.row').css({
'width': '200%',
'height': '100px',
'-webkit-animation': 'slide 50s linear infinite'
});
This causes the animation to stop playing; the row does not move. I can change other values for instance height to 200px, and the height does change. The problem is, the animation is killed.
How can I solve this?