Shopify themes, liquid, logos, and UX
Hello,
I am using the Palo Alto theme and I would like to make the following changes to the header menu on mobile:
-Centre my logo (vs. on the left)
-Move the burger menu on the left (vs. on the right)
Would be great to know which code I need to amend / add to do that.
Thank you for your help.
Regards,
Lea.
Solved! Go to the solution
This is an accepted solution.
Hi @Leadermar
1. Go to Online Store->Themes->Edit code
2. Asset->/theme.scss.liquid->paste below code at the bottom of the file.
.js-drawer-open-left .is-moved-by-drawer {
-moz-transform: translateX(300px);
-o-transform: translateX(300px);
-ms-transform: translateX(300px);
-webkit-transform: translateX(300px);
transform: translateX(300px);
}
.js-drawer-open-left .drawer--left {
display: block;
-moz-transform: translateX(300px);
-o-transform: translateX(300px);
-ms-transform: translateX(300px);
-webkit-transform: translateX(300px);
transform: translateX(300px);
}
#NavDrawer button {
float: left;
right: 0;
left: 0;
padding: 0;
}
.drawer--left {
width: 300px;
right: auto;
border-left: 1px solid #f2f2f2;
left: -300px;
border-right: 2px solid #000;
}
Hi @Leadermar
Thanks Welcome to the Shopify community!
1. Go to Online Store->Themes->Edit code
2. Asset->/theme.scss.liquid->paste below code at the bottom of the file.
.site-header__logo {
position: absolute;
right: 0;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
top: 50%;
}
.site-header__logo-link {
display: inline-block;
width: 100%;
padding: 0;
}
button.js-drawer-open-left {
position: absolute;
left: 0;
}
Hello @Vikas_Chovatiya,
Thank you so much for your answer.
I tried to add this code at the bottom of file but doesn't seem to work - not sure if I did it properly?
Thank you!
<!doctype html>
<!--[if IE 8]><html class="no-js ie9 lt-ie9" lang="en"> <![endif]-->
<!--[if IE 9 ]><html class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!--><html class="not-ie no-js"><!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
{%- if settings.favicon != blank -%}
<link rel="shortcut icon" href="{{ settings.favicon | img_url: '32x32'}}" type="image/png" />
{%- endif -%}
{% comment %} Title and description {% endcomment %}
<title>
{{ page_title }}{% if current_tags %}{% assign meta_tags = current_tags | join: ', ' %} – {{ 'general.meta.tags' | t: tags: meta_tags }}{% endif %}{% if current_page != 1 %} – {{ 'general.meta.page' | t: page: current_page }}{% endif %}{% unless page_title contains shop.name %} – {{ shop.name }}{% endunless %}
</title>
{%- if page_description -%}
<meta name="description" content="{{ page_description | escape }}">
{%- endif -%}
{% comment %} Helpers {% endcomment %}
<link rel="canonical" href="{{ canonical_url }}">
<meta name="viewport" content="width=device-width,initial-scale=1">
{{ content_for_header }}
{% comment %} CSS {% endcomment %}
{{- 'theme.scss.css' | asset_url | stylesheet_tag -}}
</head>
{%- capture body_class -%}
template-{{ template | replace: '.', ' ' | truncatewords: 1, '' | handle }} no-outline
{% if customer %} customer-logged-in{% endif %}
{% if settings.show_spacer_lines %} body--show-spacer-lines{% else %} body--hide-spacer-lines{% endif %}
{% if settings.quick_button == 'buy' %} quick-buy-enabled{% elsif settings.quick_button == 'view' %} quick-view-enabled{% endif %}
{% unless settings.show_buttons_animation %} no-button-animation{% endunless %}
{%- endcapture -%}
<body id="{{ page_title | handle }}" class="{{ body_class | strip_newlines | strip }}">
<div class="block-body"></div>
<a class="in-page-link skip-link" href="#MainContent">{{ 'general.accessibility.skip_to_content' | t }}</a>
{%- section 'popup' -%}
{%- section 'announcement-bar' -%}
{%- section 'header' -%}
<div id="PageContainer" class="is-moved-by-drawer">
<main id="MainContent" class="main-content" role="main">
{{ content_for_layout }}
</main>
{%- section 'footer' -%}
</div>
{%- render 'scripts' -%}
.site-header__logo {
position: absolute;
right: 0;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
top: 50%;
}
.site-header__logo-link {
display: inline-block;
width: 100%;
padding: 0;
}
button.js-drawer-open-left {
position: absolute;
left: 0;
}
</body>
</html>
.site-header__logo {
position: absolute;
right: 0;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
top: 50%;
}
.site-header__logo-link {
display: inline-block;
width: 100%;
padding: 0;
}
button.js-drawer-open-left {
position: absolute;
left: 0;
}
Hi @Leadermar
You add the wrong place please add this file theme.scss.liquid
Ah yes indeed! Thank you, it's working now!
Just one more thing, when I click on the menu, the burger menu is still displaying on the right side. Is there a way I can have the burger menu on the left side as well?
Thank you so much for your help,
Lea.
This is an accepted solution.
Hi @Leadermar
1. Go to Online Store->Themes->Edit code
2. Asset->/theme.scss.liquid->paste below code at the bottom of the file.
.js-drawer-open-left .is-moved-by-drawer {
-moz-transform: translateX(300px);
-o-transform: translateX(300px);
-ms-transform: translateX(300px);
-webkit-transform: translateX(300px);
transform: translateX(300px);
}
.js-drawer-open-left .drawer--left {
display: block;
-moz-transform: translateX(300px);
-o-transform: translateX(300px);
-ms-transform: translateX(300px);
-webkit-transform: translateX(300px);
transform: translateX(300px);
}
#NavDrawer button {
float: left;
right: 0;
left: 0;
padding: 0;
}
.drawer--left {
width: 300px;
right: auto;
border-left: 1px solid #f2f2f2;
left: -300px;
border-right: 2px solid #000;
}
It's working perfectly fine now, thank you so much for your help @Vikas_Chovatiya !
Hi @Vikas_Chovatiya,
Actually I noticed that I have now 2 logos on my mobile header (except for the home page) 😞
Hi @Leadermar
It can be done by doing some code customization.
Please take the help of a developer and hire Shopify Expert or me
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024