Answers for "javascript prevent space from scrolling"

0

javascript prevent space from scrolling

window.addEventListener('keydown', function(e) {
  if(e.keyCode == 32 && e.target == document.body) {
    e.preventDefault();
  }
});
Posted by: Guest on June-25-2021

Code answers related to "javascript prevent space from scrolling"

Code answers related to "Javascript"

Browse Popular Code Answers by Language