Jump to content

Adding a custom icon next to the hamburger nav icon

Go to solution Solved by tuanphan,

Recommended Posts

Posted (edited)

Is it possible to add a 'Font Awesome' icon or any custom icon next to the hamburger nav icon and link it to the search page?

Like so:

Screenshot2023-09-17at12_38_55.thumb.png.b505ff19577cbf5afaf19d1790e1f170.png

 

 

I already have Font Awesome set up on my website and would like to use this icon:

<i class="fa-solid fa-magnifying-glass"></i>

Website URL: https://steven.squarespace.com

Thank you

Edited by pro
Posted
15 hours ago, tuanphan said:

This is FontAwesome 5 or 6. And have you declared FontAwesome Library link to Code Injection Header yet?

 

Hi Tuan, it's Font Awesome 6. And yes, I've already declared it in the header.

  • Solution
Posted
On 9/22/2023 at 7:12 AM, pro said:

 

Hi Tuan, it's Font Awesome 6. And yes, I've already declared it in the header.

Add to Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
  $(document).ready(function(){
    $('<a href="/search" class="custom-search"><i class="fa-solid fa-magnifying-glass"></i></a>').insertBefore('.header-burger');
});
</script>
<style>
  a.custom-search {
    margin-right: 20px;
    display: inline-block;
}
</style>

image.png.222020dda9c2c800f19d5b0ed53d059e.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Posted
7 hours ago, tuanphan said:

Add to Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
  $(document).ready(function(){
    $('<a href="/search" class="custom-search"><i class="fa-solid fa-magnifying-glass"></i></a>').insertBefore('.header-burger');
});
</script>
<style>
  a.custom-search {
    margin-right: 20px;
    display: inline-block;
}
</style>

image.png.222020dda9c2c800f19d5b0ed53d059e.png

 

Hi Tuan, thank you for the code. One slight visual issue though.

It looks fine on desktop, but on mobile, the spacing is a little off.

This is the original without the code:

IMG_0002.PNG.0c06dbd2309f1764fb83f8e166a8af9c.PNG

 

 

And this is with the code:

IMG_0001.PNG.f9d662d0670d4322d1d8abcb9da8e6b8.PNG

 

Would it be possible to have it look as close to the original as possible?

 

As always, thank you for your time.

Posted
40 minutes ago, tuanphan said:

Use this code under

<style>
  @media screen and (max-width:767px) {
  .header-burger {
    left: -5vw !important;
    position: relative;
}
a.custom-search {
    position: relative;
    left: -3vw;
}
  }
</style>

 

 

Thank you, Tuan!

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.