Skip to content

Instantly share code, notes, and snippets.

@smashercosmo
Created July 28, 2021 23:11
Show Gist options
  • Save smashercosmo/466c75cdc774be2bc524922b7dee407e to your computer and use it in GitHub Desktop.
Save smashercosmo/466c75cdc774be2bc524922b7dee407e to your computer and use it in GitHub Desktop.
Check for smooth scrolling support
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