Skip to content

Instantly share code, notes, and snippets.

@wokalek
Last active February 1, 2017 11:38
Show Gist options
  • Save wokalek/8a55adfe49a35022677dba4f1ec11701 to your computer and use it in GitHub Desktop.
Save wokalek/8a55adfe49a35022677dba4f1ec11701 to your computer and use it in GitHub Desktop.
Cansel scroll on flag
// Stack scroll by flag
function ScrollControll(flag)
{
if (flag)
{
scrollTop = $(window).scrollTop();
scrollLeft = $(window).scrollLeft();
$(window).on('scroll mousewheel', function(event)
{
event.preventDefault();
event.stopPropagation();
$(window).scrollTop(scrollTop);
$(window).scrollLeft(scrollLeft);
});
}
else
{
$(window).off('scroll mousewheel');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment