I'm newbie. I got a code which is working well, but how can I make it playable while mouseover and stopable when mouseout in JavaScript(jQuery). Also I want that when we'll mouseover again an animation start from start. I added a couple lines such as:
$('document').ready(function()
$('#bodymovin').hover(function()
to make hover effect, but animation is still playing when mouseover and also isn't showing my <div>
until I mouseover at the start (that's not good :( ).
It would be great if you'll write comments near a lines of code. Thank you.
<script>
$('document').ready(function() {
$('#bodymovin').hover(function() {
var anim;
var animData = {
container: document.getElementById('bodymovin'),
renderer: 'svg',
loop: false,
autoplay: true,
rendererSettings: {
progressiveLoad:false
},
path: 'data.json'
};
anim = bodymovin.loadAnimation(animData);
});
});
</script>