Answer the question
In order to leave comments, you need to log in
How to remove block twitching when scrolling?
There is a block for mobile devices that opens / closes using the Toggler(Foundation) plugin. I want to make the block hidden not only by clicking on the button as it is now, but also by scrolling (or by clicking outside the block). When you start scrolling, the block twitches and is not always hidden. How to fix a bug, can select another event?
An example for visual display of twitching, the code in the project is different.
(It didn’t work to play it through the snippet)
I close the block using the plugin method
$(window).scroll(function() {
let menuStatus = $('#js-mobile-menu').attr('aria-expanded');
if( menuStatus === 'true') {
$('#js-mobile-menu').foundation('toggle');
}
});
Answer the question
In order to leave comments, you need to log in
As the wheel spins, there are many scroll events fired.
$(window).scroll(function(evt) {
console.log(evt)
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question