Remove smooth scroll effect from blog index/category pages, remove globally if user prefers reduced motion

This commit is contained in:
Kyle Gordy 2019-12-05 11:02:44 -05:00
parent 80e2c41f04
commit 7dfcb64930
2 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,8 @@
<!DOCTYPE html>
<html lang="{{ page.lang | default: site.lang | default: "en" }}">
{% if page.url contains "/category" or page.url contains "/page" or page.url == "/blog/" %}
{% assign class = 'no-smooth-scroll' %}
{% endif %}
<html class="{{ class }}" lang="{{ page.lang | default: site.lang | default: "en" }}">
{%- include head.html -%}
<body>
{%- include header.html -%}

View File

@ -1,5 +1,10 @@
html {
scroll-behavior: smooth; // smooth anchor link scrolling
// Smooth anchor scrolling unless .no-smooth-scroll is present
html:not(.no-smooth-scroll) {
scroll-behavior: smooth;
@media (prefers-reduced-motion: reduce) {
scroll-behavior: auto; // turn off if user prefers reduced motion
}
}
body {