1
Guys, somebody give me a light. I’m taking some events with socket.io and putting a modal when I receive, but I get mt event and the modal Uga I’m trying to use a settimeout even more this buggy if someone can help me. follows the code:
var statusFollow = 'on',
countevent = 0,
eventended = 0
socket.on('msg', (msg) => {
$('.last-follow').find('div').html(msg)
countevent++
setTimeout(() => {
$('.modal-body').html(msg+' É um novo seguidor')
$('.modal').modal('show')
setTimeout(()=>{
document.querySelector('.modal').classList.remove('animated', 'slideInDown')
setTimeout(()=>{
document.querySelector('.modal').classList.add('animated', 'slideOutUp')
document.querySelector('.modal').addEventListener('animationend', () => {
document.querySelector('.modal').removeEventListener('animationend', () => {})
$('.modal').modal('hide')
document.querySelector('.modal').classList.remove('animated', 'slideOutUp')
document.querySelector('.modal').classList.add('animated', 'slideInDown')
})
countevent--
}, 2000)
}, 3000)
}, countevent * 5000)
console.log('Eventos Restantes: '+(countevent - eventended))
statusFollow = 'on'
console.log(msg)
})
Your question is too superficial. You have to explain better what your code does in practice so we can try to visualize the problem, and what kind of bug is going on. Only with this information becomes complicated.
– Sam
So here’s my friend. i receive an event via webhook when I gain a new follower on a streaming platform when I receive a new follower the modal d bootstrap appears and disappears after 3 seconds. but when I get more than one follower at the same time the modal disappears faster and appears above. for I received one more follower before the modal animation came to an end
– Rogério Mateus Bonfim
Put the CSS of the animations and the slideInDown and slideOutUp classes that I will try to play here.
– Sam
Probably you are animating the modal via CSS and the
animationend
is conflicting with the standard Bootstrap animation.– Sam
For animations I am using this https://daneden.github.io/animate.css/
– Rogério Mateus Bonfim