I have incorporated a Bootstrap 4 modal in my website to display a large navigation menu. The navigation is triggered by a toggle button with a CSS animation that transforms a hamburger icon into an X.
However, I encountered an issue where if the button is clicked too quickly before the modal animation completes, it displays the X icon even when the menu/modal is closed.
Is there a way to prevent the button from being clickable until the modal animation finishes?
This is the code I am currently using:
$('.menu').click(function(){
$('#burger').toggleClass('active');
});
I came across a method to detect when the modal animation is complete:
$('#myModal').on('shown', function () {
// do something…
})
Unfortunately, I'm having trouble integrating this into my existing function.
You can view my current code here: https://codepen.io/cray_code/pen/JjjqRpN