Triangle-MX / Triangle-4.0

The new version of our site...
https://triangle.mx/
Other
5 stars 0 forks source link

Not blocked scroll while on menu #30

Open Alvlopzam opened 6 years ago

Alvlopzam commented 6 years ago

While the user is on the menu the scroll is not blocked as expected.

JPIglesias-Triangle commented 6 years ago
 $(window).bind('mousewheel', function(event) { event.preventDefault(); }); 

This snippet blocks scrolling, however, it seems the only way of cancelling it is to reload the page. Will look into alternatives.

JPIglesias-Triangle commented 6 years ago

For mobile:

$(window).bind('touchmove', function(event) { event.preventDefault(); });
JPIglesias-Triangle commented 6 years ago

Branch menu-issues created to solve this issue.

JPIglesias-Triangle commented 6 years ago

Managed to get it blocked when user opens the menu, but only managed to unblock it if the user clicks outside the menu trigger.

// Block
$('body').bind('mousewheel', function(event) { event.preventDefault(); });
$('body').bind('touchmove', function(event) { event.preventDefault(); });

// Unblock
$('body').unbind('mousewheel');
$('body').unbind('touchmove');