Scroll to top when selecting category (#18072)

This commit is contained in:
Joakim Sørensen 2021-06-03 12:37:38 +02:00 committed by GitHub
parent 2f9169e6f0
commit aed1255866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,11 +47,11 @@ regenerate: false
{%- for category in categories -%} {%- for category in categories -%}
{%- assign components_count = components | where: 'ha_category', category | size -%} {%- assign components_count = components | where: 'ha_category', category | size -%}
{%- if category and category != 'Other' and components_count != 0 -%} {%- if category and category != 'Other' and components_count != 0 -%}
<a href='#{{ category | slugify }}' class="btn">{{ category }} ({{ components_count }})</a> <a href='#{{ category | slugify }}' class="btn" onclick="document.querySelector('.page-content').scrollTop = 0">{{ category }} ({{ components_count }})</a>
{%- endif -%} {%- endif -%}
{%- endfor -%} {%- endfor -%}
<a href='#other' class="btn">Other ({{ components | where: 'ha_category', 'Other' | size }})</a> <a href='#other' class="btn" onclick="document.querySelector('.page-content').scrollTop = 0">Other ({{ components | where: 'ha_category', 'Other' | size }})</a>
</div> </div>
</div> </div>
<div class="grid__item five-sixths lap-one-whole palm-one-whole"> <div class="grid__item five-sixths lap-one-whole palm-one-whole">