Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript prevent space from scrolling

window.addEventListener('keydown', function(e) {
  if(e.keyCode == 32 && e.target == document.body) {
    e.preventDefault();
  }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #prevent #space #scrolling
ADD COMMENT
Topic
Name
6+2 =