Created
July 28, 2021 23:11
-
-
Save smashercosmo/466c75cdc774be2bc524922b7dee407e to your computer and use it in GitHub Desktop.
Check for smooth scrolling support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function testSupportsSmoothScroll() { | |
let supports = false | |
try { | |
const div = window.document.createElement('div') | |
div.scrollTo({ | |
top: 0, | |
get behavior() { | |
supports = true | |
return 'smooth' | |
}, | |
}) | |
} catch (err) {} | |
return supports | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment