Hey, I added the code one by one:
Icon to header in header.liquid
<a href="#" id="drawerIcon" class="header__icon header__icon--custom link focus-inset">
<img src="{{ 'support_icon.png' | asset_url }}" alt="Support Icon" width="27">
</a>
<div id="myDrawer" class="drawer hidden">
<span class="close-drawer">×</span>
<div class="drawer-content">
<h2>Chromemaster</h2>
<!-- Dodaj inne treści, linki itp. tutaj -->
</div>
</div>
i made custom.js
document.addEventListener('DOMContentLoaded', function () {
var drawer = document.getElementById('myDrawer');
var drawerIcon = document.querySelector('.header__icon--custom');
if (!drawer || !drawerIcon) {
console.error('Nie znaleziono elementów.');
return;
}
drawerIcon.addEventListener('click', function () {
drawer.style.height = '100%';
});
var closeDrawerButton = drawer.querySelector('.close-drawer');
if (closeDrawerButton) {
closeDrawerButton.addEventListener('click', function () {
drawer.style.height = '0';
});
}
});
i put this in theme.liquid
{{ 'custom.js' | asset_url | script_tag }}
and base.css
.drawer {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 0;
background-color: black;
overflow: hidden;
transition: height 0.3s ease-in-out;
z-index: 999;
}
.drawer-content {
padding: 20px;
color: orange;
}
.close-drawer {
cursor: pointer;
position: absolute;
top: 10px;
right: 10px;
font-size: 18px;
color: orange;
}
And my drawer doesnt work. I wanna do someting like slide-out rectangle under the icon.
Dawn theme
https://5a8ab2.myshopify.com/#
123
my head is steaming