Skip to content

Instantly share code, notes, and snippets.

@jimyuan
Created September 8, 2017 05:42
Show Gist options
  • Save jimyuan/12ca8bb38e7b6904f7bde1f271d9406a to your computer and use it in GitHub Desktop.
Save jimyuan/12ca8bb38e7b6904f7bde1f271d9406a to your computer and use it in GitHub Desktop.

Revisions

  1. jimyuan created this gist Sep 8, 2017.
    3 changes: 3 additions & 0 deletions css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    .disable-hover {
    pointer-events: none;
    }
    9 changes: 9 additions & 0 deletions js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    window.addEventListener('scroll', () => {
    let body = document.body, timer
    clearTimeout(timer)
    !body.classList.contains('disable-hover') && body.classList.add('disable-hover')

    timer = setTimeout(() => {
    body.classList.remove('disable-hover')
    }, 500);
    }, false);