HTML
xxxxxxxxxx
1
<div id='animationDiv' style="background-color: yellow;width: 500px">
2
Fade IN
3
</div>
4
<button onclick="startAnimateDiv()">
5
start animation
6
</button>
7
8
<button onclick="stopAnimateDiv()">
9
stop animation
10
</button>
CSS
1
1
JS
xxxxxxxxxx
1
const element = document.getElementById('animationDiv');
2
3
function startAnimateDiv() {
4
const animationInstance = mdb.Animate.getOrCreateInstance(element, {
5
animation: 'fade-in',
6
animationStart: 'manually',
7
animationReset: true
8
});
9
animationInstance.init();
10
animationInstance.startAnimation();
11
}
12
13
function stopAnimateDiv() {
14
const animationInstance = mdb.Animate.getOrCreateInstance(element, {
15
animation: 'fade-in',
16
animationStart: 'manually',
17
animationReset: true
18
});
19
animationInstance.startAnimation();
20
}
21
Console errors: 0