I have some scrolling actions after keydown, keypress pressing. So this is what it looks like:
$(document).keydown(function(e) {
e.stopPropagation();
if (e.keyCode === 40) {
// some scrolling actions in specifie div
} else if (e.keyCode === 38) {
// some scrolling actions in specifie div
}
});
Everithing is working fine but when im scrolling, keypressing with my div scrolls also whole page. Is there any option to stop this body scrolling?
You need
.preventDefault()in there…