Jump to content

Replacing Link icon with custom icon

Recommended Posts

wellworndenim.squarespace.com

pass: wellworndenim

Heya, I'm pretty stuck here. This is a part of development that I've not learnt to deal with well. Apologies if I over explained below, I just wanted to be clear.

I wanted to replace a generic link icon in the main nav with the Etsy logo.  I found a way to do this, but there's an issue.

I use the following code:

 

@media only screen and (min-width:800px) {
  .icon--fill:nth-of-type(1) {
    svg {
      display:none;
    }    
    background-image: url(https://static1.squarespace.com/static/5ed9495a8b705f28b7e9ba1a/t/5f158f068f488a75b54f8328/1595248390506/etsy4.png);    
    background-size: 100%;    
    background-repeat: no-repeat;  
  }
}  
.header-menu-actions-action:nth-of-type(1) {    
  svg {
    display:none;    
  }    
  background-image: url(https://static1.squarespace.com/static/5ed9495a8b705f28b7e9ba1a/t/5f158f068f488a75b54f8328/1595248390506/etsy4.png);    
  background-size: 100%;    
  background-repeat: no-repeat;  
}


It replaces the generic icon with my uploaded Etsy icon on both mobile and desktop. However, the cut-off the with media  query is causing issues on my iPad pro in portrait mode.

If you go to the site, you'll see in the nav bar there are two links designated by icons. Etsy and Instagram. As the Etsy logo wasn't supported by Squarespace's social links and just produced a generic Link icon, I had to place a custom solution.

The code above targets just the generic link icon, and it requires two different blocks of code: one for desktop, one for mobile.

The code tells the site to load the custom icon, but if the width is above 800px it should load the desktop version. If the mobile menu appears above the min-width of the media query, it uses the desktop code which is not compatible and BOTH links are replaced with the custom Etsy Icon.

Due to the iPad's pixel density in portrait mode being way above 800px, and the fact it uses the mobile menu in that mode, it loads the desktop version while it's showing the mobile menu and shows two Etsy logos.

I can't bring the media query up to the size of the iPad's screen's portrait mode, as that would break the desktop link on smaller laptop screens or if the window were resized.

Is there a solution for this where I can specifically target the mobile menu itself, whenever it appears? Or some cleaner way of doing this?

Any help would be very much appreciated!

 

Link to comment
  • 3 months later...
  • Replies 2
  • Views 1.1k
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.