LouisWhit
12/2/2013 - 3:38 PM

Disable pointer events to improve scrolling performance on websites that have many hover effects.

Disable pointer events to improve scrolling performance on websites that have many hover effects.

var body = document.body,
    timer;

window.addEventListener('scroll', function() {
  clearTimeout(timer);
  if(!body.classList.contains('disable-hover')) {
    body.classList.add('disable-hover')
  }
  
  timer = setTimeout(function(){
    body.classList.remove('disable-hover')
  },500);
}, false);
.disable-hover,
.disable-hover * {
  pointer-events: none !important;
}