I have an animation and after the animation is complete I use a partial view to update the data.
.on('animationend webkitAnimationEnd oAnimationEnd')
only seems to be firing the first time. Any idea why this is happening, it's like the JQuery isn't recognizing the $('#marqueeTop span')
.Here is a jsfiddle of what I would like it to do.
Partial
<div id="marqueeTop">
<span class="moveTop">
@foreach(var item in Model){
<label>
@Html.DisplayFor(x => item.GroupName)
@Html.DisplayFor(x => item.Sales ).....
</label>
}
</span>
</div>
CSS
#marqueeTop {
width: 100%;
margin: 0 auto;
white-space: nowrap;
overflow: hidden;
box-sizing: border-box;
}
#marqueeTop span {
display: inline-block;
padding-left: 100%;
text-indent: 0;
font-family:wallStreetFont;
}
.moveTop{
animation: marqueeTop 5s linear infinite;
animation-iteration-count:1;
}
JQuery
$('#marqueeTop span').on('animationend webkitAnimationEnd oAnimationEnd', function () {
$.get('/Home/GetBookingsTicker', function (response) {
$('#marqueeTop').replaceWith(response);
});
});