I'm having little luck stopping or pausing an animation in Android 4.x browser / webview. I have -webkit-animation-iteration-count set to infinite and it's no problem stopping it in Chrome/Safari, but it fails in Android if the element has animated children.
My HTML:
<div id="css-container" onclick="stopAnim();">
<div id="content">Content</div>
</div>
My JS:
function stopAnim() {
// cssContent.classList.toggle('css-container-anim');
cssContainer.classList.toggle('css-container-anim');
}
var cssContainer = document.getElementById("css-container");
var cssContent= document.getElementById("content");
cssContainer.classList.toggle('css-container-anim');
cssContent.classList.toggle('css-container-anim');
You can see the problem in this fiddle. If I uncomment the stopping (removal of the animation class) of the content, then I can stop the animation.
I guess it might be some bubbling issue that I fail to understand? Or is it an Android bug? I have also tried directly manipulating the style via JS instead and also setting webkitAnimationPlayState to paused instead of changing class, but that changes nothing.
Note, the fiddle works in Chrome on Android but just not the stock browser - which I need because of the webview.