Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions config/settings_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 24 additions & 2 deletions layout/theme.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@
{% endif %}

{%- render 'meta-tags' -%}

<style>
/* Critical CSS for Mobile LCP and CLS */
body { margin: 0; }
#header-group { min-height: var(--header-height, 60px); }
@media screen and (max-width: 749px) {
.header__columns { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.header__row--top { padding: 8px 16px; }
}
/* Prevent main content layout shift before CSS loads */
.content-for-layout { opacity: 0; animation: fadeIn 0.5s forwards 0.3s; }
@keyframes fadeIn { to { opacity: 1; } }
</style>

{%- render 'stylesheets' -%}
{%- render 'fonts' -%}
{%- render 'scripts' -%}
Expand All @@ -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 }}
</head>

<body class="page-width-{{ settings.page_width }} card-hover-effect-{{ settings.card_hover_effect }}">
<body class="page-width-{{ settings.page_width }} card-hover-effect-{{ settings.card_hover_effect }}{% if settings.disable_animations_mobile %} animations-disabled-mobile{% endif %}">
{% render 'skip-to-content-link', href: '#MainContent', text: 'accessibility.skip_to_text' %}
<div id="header-group">
{% sections 'header-group' %}
Expand Down
2 changes: 2 additions & 0 deletions sections/header.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@
<script
src="{{ 'header.js' | asset_url }}"
type="module"
defer="defer"
fetchpriority="low"
></script>

{% stylesheet %}
Expand Down
5 changes: 1 addition & 4 deletions snippets/scripts.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@

<script
src="{{ 'view-transitions.js' | asset_url }}"
async
{% if settings.page_transition_enabled or settings.transition_to_main_product %}
blocking="render"
{% endif %}
defer="defer"
></script>

<link
Expand Down
4 changes: 3 additions & 1 deletion snippets/stylesheets.liquid
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
{{ 'overflow-list.css' | asset_url | preload_tag: as: 'style' }}
{{ 'base.css' | asset_url | stylesheet_tag: preload: true }}
<link rel="preload" href="{{ 'base.css' | asset_url }}" as="style">
<link rel="stylesheet" href="{{ 'base.css' | asset_url }}" media="print" onload="this.media='all'">
<noscript>{{ 'base.css' | asset_url | stylesheet_tag }}</noscript>