Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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