diff --git a/assets/base.css b/assets/base.css index 91012cce3..2f141d692 100644 --- a/assets/base.css +++ b/assets/base.css @@ -3748,6 +3748,29 @@ fly-to-cart.fly-to-cart--sticky { } } +/* ============================================================================ + Mobile Performance - Disabled Animations Override + ============================================================================ */ +@media screen and (max-width: 749px) { + body.animations-disabled-mobile * { + /* Disable all CSS Scroll-Driven reveals (native feature used heavily in this theme) */ + animation-timeline: none !important; + } + + body.animations-disabled-mobile .slide__content { + /* Specifically prevent the slide reveal animation to load instantly */ + animation: none !important; + opacity: 1 !important; + translate: 0 0 !important; + } + + /* Disable costly View Transition animations on mobile */ + body.animations-disabled-mobile::view-transition-old(*), + body.animations-disabled-mobile::view-transition-new(*) { + animation: none !important; + } +} + @keyframes search-element-slide-out-bottom { 0% { transform: translateY(0); diff --git a/config/settings_schema.json b/config/settings_schema.json index 9a27dce58..d299bd625 100644 --- a/config/settings_schema.json +++ b/config/settings_schema.json @@ -1403,6 +1403,13 @@ "label": "t:settings.add_to_cart_animation", "default": true }, + { + "type": "checkbox", + "id": "disable_animations_mobile", + "label": "Disable animations on mobile", + "info": "Improves performance by disabling scroll reveals and page transitions on small screens.", + "default": true + }, { "type": "select", "id": "card_hover_effect", diff --git a/layout/theme.liquid b/layout/theme.liquid index 2b6b6a151..d96745704 100644 --- a/layout/theme.liquid +++ b/layout/theme.liquid @@ -25,6 +25,20 @@ {% endif %} {%- render 'meta-tags' -%} + + + {%- render 'stylesheets' -%} {%- render 'fonts' -%} {%- render 'scripts' -%} @@ -35,10 +49,18 @@ {%- render 'theme-editor' -%} {% endif %} - {{ content_for_header }} + {%- capture cfh -%}{{ content_for_header }}{%- endcapture -%} + {%- if cart.item_count == 0 -%} + {% comment %} + Conditionally disable UpsellPlus scripts when the cart is empty to improve performance. + Using 'upsell' and 'Upsell' as substrings based on the implementation plan. + {% endcomment %} + {%- assign cfh = cfh | replace: 'upsell', 'disabled-upsell' | replace: 'Upsell', 'disabled-Upsell' -%} + {%- endif -%} + {{ cfh }} -
+ {% render 'skip-to-content-link', href: '#MainContent', text: 'accessibility.skip_to_text' %}