Shopify themes, liquid, logos, and UX
Hello community, Thank you all for contribution to make our experience better and easy in shopify , i have a question:
i’m using craft theme, so by clicking on the header i can select from the menu if always sticky or none and it’s working perfectly, recently i made changes so that i can make a transparent header to the slideshow and the changes was:
Replace the following code
<header class="header header--{{ section.settings.logo_position }} page-width{% if section.settings.menu != blank %} header--has-menu{% endif %}">
With the following code
<header id="site-header" class="header header--{{ section.settings.logo_position }} page-width{% if section.settings.menu != blank %} header--has-menu{% endif %} {% if section.settings.transparent_header %}site-header-transparent{% endif %}">
Replace the following code
<details id="Details-menu-drawer-container" class="menu-drawer-container">
<summary class="header__icon header__icon--menu header__icon--summary link focus-inset" aria-label="{{ 'sections.header.menu' | t }}">
With the following code
<details id="Details-menu-drawer-container" class="menu-drawer-container">
<summary id="header-menu" class="header__icon header__icon--menu header__icon--summary link focus-inset" aria-label="{{ 'sections.header.menu' | t }}">
Replace the following code
<details-modal class="header__search">
With the following code
<details-modal id="header-search" class="header__search">
{% if template == 'index' and section.settings.transparent_header %} {% style %} .template-index .site-header-transparent .header__icon, .template-index .site-header-transparent .header__menu-item span, .template-index .site-header-transparent .header__menu-item svg, .template-index .site-header-transparent .header__active-menu-item { color: {{ section.settings.content_color }}; } .site-header-transparent { background: transparent; position: absolute; border: none; width: 100%; left: 50%; transform: translateX(-50%); } .site-header-transition { margin-top: var(--header-height); } {% endstyle %} <!--- Coded by websensepro.com - youtube.com/c/websensepro ---> <script> document.addEventListener("DOMContentLoaded", function(event) { var headerHeight = document.getElementById('site-header').offsetHeight; document.getElementById('MainContent').style.setProperty('--header-height', '-'+ headerHeight + 'px'); }); window.onscroll = function() { var header = document.getElementById('site-header'); var main = document.getElementById('MainContent'); var height = document.getElementById('site-header').offsetHeight; if ( window.pageYOffset > height ) { header.classList.remove('site-header-transparent'); main.classList.add('site-header-transition'); } else { header.classList.add('site-header-transparent'); main.classList.remove('site-header-transition'); } } document.getElementById("header-menu").addEventListener('click',function () { var sideMenu = document.getElementById('Details-menu-drawer-container'); var header = document.getElementById('site-header'); var height = document.getElementById('site-header').offsetHeight; if ( window.pageYOffset < height ) { if (!sideMenu.classList.contains('menu-opening')) { header.classList.remove('site-header-transparent'); } else { header.classList.add('site-header-transparent'); } } }); document.getElementById("header-search").addEventListener('click',function () { var search = document.getElementById('template-index'); var header = document.getElementById('site-header'); var main = document.getElementById('MainContent'); var height = document.getElementById('site-header').offsetHeight; if ( window.pageYOffset < height ) { if (search.classList.contains('overflow-hidden')) { header.classList.remove('site-header-transparent'); main.classList.add('site-header-transition'); } else { header.classList.add('site-header-transparent'); main.classList.remove('site-header-transition'); } } }); </script> {% endif %}
{
"type": "header",
"content": "Transparent Header"
},
{
"type": "checkbox",
"id": "transparent_header",
"label": "Enable transparent header",
"default": false
},
{
"type": "color",
"id": "content_color",
"label": "Change icon & text color"
},
Replace the following code
<body class="gradient">
With the following code
<body {% if template == 'index' %}id="template-index"{% endif %} class="gradient {% if template == 'index' %}template-index{% endif %}">
And i’ve got the transparent header option on my customization
After this changes the sticky option is not working at all, appreciate the support in advance
Thank you..
It seems like you have already made the necessary changes to enable the transparent header in your Craft theme. However, if you're experiencing issues or need further customization, here are some steps you can follow:
To center the main menu:
.header__navigation {
display: flex;
justify-content: center;
}
Save the changes and check if the main menu is now centered on your website.
To customize the add to cart button:
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025