Jump to content

Adding a custom icon next to the hamburger nav icon

Go to solution Solved by tuanphan,

Recommended Posts

  • Solution
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!)

Link to comment
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.

Link to comment

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.