Jump to content

Add custom symbols in header (7.1)

Go to solution Solved by HoaLT,

Recommended Posts

Site URL: https://orchid-guitar-kx7j.squarespace.com/

I have set up a language changer on a clients website through two clickable symbols.
It's working perfectly, but now I'm having trouble placing it in the header.
I need to scale along with the rest of the header. Ideally I'd want to place it within the header itself.
Right now it's just placed on top of the header rather than inside it.

Password: 1234

This is the code I'm currently using

 

/*setup language switcher*/

.language {
  color: #fff;
  position: absolute;
  top: 2.8vw;
  right: 3vw;
  z-index: 99999;
  a {
    color: #fff;
    &:hover {
      opacity: 0.8;
    }
  }
  }
@media screen and (max-width:800px)
{
  .language {
  color: #fff;
  position: absolute;
  top: 4.9vh;
  right: 23vw;
  z-index: 99999;
  a {
    color: #fff;
    &:hover {
      opacity: 0.8;
    }
  }
  }
}




https://orchid-guitar-kx7j.squarespace.com/

Edited by Sahil007
the url was written twice
Link to comment
46 minutes ago, Sahil007 said:

Site URL: https://orchid-guitar-kx7j.squarespace.com/

I have set up a language changer on a clients website through two clickable symbols.
It's working perfectly, but now I'm having trouble placing it in the header.
I need to scale along with the rest of the header. Ideally I'd want to place it within the header itself.
Right now it's just placed on top of the header rather than inside it.

Password: 1234

This is the code I'm currently using

 

/*setup language switcher*/

.language {
  color: #fff;
  position: absolute;
  top: 2.8vw;
  right: 3vw;
  z-index: 99999;
  a {
    color: #fff;
    &:hover {
      opacity: 0.8;
    }
  }
  }
@media screen and (max-width:800px)
{
  .language {
  color: #fff;
  position: absolute;
  top: 4.9vh;
  right: 23vw;
  z-index: 99999;
  a {
    color: #fff;
    &:hover {
      opacity: 0.8;
    }
  }
  }
}




https://orchid-guitar-kx7j.squarespace.com/

You could add this customization in Design > Custom Css

Hope it work well for you

.header-nav {
  padding-right: 10vh;
}

.language {
  top: 10vh;
}

.lang-no {
  margin-right: 2vh;
}

 

Link to comment
21 hours ago, HoaLT said:

You could add this customization in Design > Custom Css

Hope it work well for you

.header-nav {
  padding-right: 10vh;
}

.language {
  top: 10vh;
}

.lang-no {
  margin-right: 2vh;
}

 

Didn't work I'm afraid. The symbols jump up to the top of the page in a white box of its own.

Link to comment
  • Solution
47 minutes ago, Sahil007 said:

Didn't work I'm afraid. The symbols jump up to the top of the page in a white box of its own.

After reviewing again your code, you could try again the following steps:

Step 1. Javascript:

Adding the div class ="language" in the header-inner, you can achieve it by changing one bit of your script in the code injection...

from

/*setup language switcher with flags*/
$('body').prepend('<div class="language">

to

/*setup language switcher with flags*/
$('.header-inner').append('<div class="language">

Step2. Adding Design > Custom Css

@media only screen and (min-width: 1024px) {
  .language {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
  }
  .header-nav-wrapper {
    padding-right: 100px;
  }  
}


@media only screen and (max-width: 1023px) {
  .language {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      padding-right: 50px;
  }  
}

Hope it works for you!

Link to comment
21 minutes ago, HoaLT said:

After reviewing again your code, you could try again the following steps:

Step 1. Javascript:

Adding the div class ="language" in the header-inner, you can achieve it by changing one bit of your script in the code injection...

from

/*setup language switcher with flags*/
$('body').prepend('<div class="language">

to

/*setup language switcher with flags*/
$('.header-inner').append('<div class="language">

Step2. Adding Design > Custom Css

@media only screen and (min-width: 1024px) {
  .language {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
  }
  .header-nav-wrapper {
    padding-right: 100px;
  }  
}


@media only screen and (max-width: 1023px) {
  .language {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      padding-right: 50px;
  }  
}

Hope it works for you!

 

19 minutes ago, HoaLT said:

PS: You got 2 jQuery instance on the site, consider to remove one of them and move it into top of header injection

image.png.0dee84caf8a8994a8833db147c3ca9f3.png

BTW, here is the result I got with the update position, both desktop and mobile:

image.thumb.png.53ffc70f1725e9a70f80dda6cd69ce4d.png

image.png.e6f09b0013d714321a49078671e94947.png

Thank! Now it works just as i need it too!
Yeah, I know about that double jQuery, but for some reason the script stopped working when I tried to remove it. As long as it's not breaking anything I'll let it be.

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.