Last active
June 2, 2023 10:49
-
-
Save mxmason/a932795b9bea7cc616cb9d01727e5771 to your computer and use it in GitHub Desktop.
These snippets completely disable the smooth-scroll animation that is present on all Webflow sites. Animated scrolling can disorient or surprise users, or even cause motion sickness!
This file contains hidden or 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
// Disable smooth scrolling for users who have set `prefers-reduced-motion` in their operating system | |
// 1. Place this snippet before the end of the <body> tag; | |
// NOT in the <head> tag! | |
// 2.Make sure it's inside $(function() {})! | |
$(function() { | |
const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)'); | |
if (mediaQuery.matches) $(document).off('click.wf-scroll'); | |
}) |
This file contains hidden or 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
// Disable smooth scrolling for ALL users | |
// 1. Place this snippet before the end of the <body> tag; | |
// NOT in the <head> tag! | |
// 2. Make sure it's inside $(function() {})! | |
$(function() { | |
$(document).off('click.wf-scroll'); | |
}) |
THANKS! This scroll and history stuff are a nightmare!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this @mxmason!