I'm currently working on customising the language switcher classes and trying to find the html code that structures the <div class="language_switcher_class> with the <div class="globe_class"> in it. The default hubspot language switcher module only contains a line of code to specify the display mode. Can anyone help me with where I can find the html code that contains the structuring for the language switcher tab?
It you set the hover on the parent element that contains everything it should work. For example, on HubSpot's boilerplate theme (GitHub) it's wrapped in the header__language-switcher class in the header global group like this:
If you mean centering the dropdown (the lang_list_class), you could update the positioning of the CSS above, like this (I updated the left property and added a transform property):
The code you're seeing in the Language Switcher module is the language switcher tag and I'm afraid the HTML can't be edited. However, others seem to have found possible custom solutions on threads like this one.
What kind of customizations are you trying to do? I've managed to make it look fairly different using CSS only. You could have something like side-by-side language options:
Could you help me to display only the first two letters of the language? I mean, for English, only display "EN" on the language switcher - like both images you've just presented as an example.
I've tried something similar to the code below but isn't working.
@LaMartins - I've just used JavaScript to do it in the past:
// Switch language switcher text (e.g. from "English" to "EN")
langLinks.forEach(function (item) {
var langLink = item;
var language = langLink.dataset.language;
langLink.text = language.toUpperCase();
});
But a HubL option would be nice because sometimes you can see the transition on load.
Thank you for your response! I'm trying to edit my language switcher css so that instead of the menu appearing on hover over just the globe icon, the menu appears if I hover over the entire capsule containing the icon and language label.
It you set the hover on the parent element that contains everything it should work. For example, on HubSpot's boilerplate theme (GitHub) it's wrapped in the header__language-switcher class in the header global group like this:
If you mean centering the dropdown (the lang_list_class), you could update the positioning of the CSS above, like this (I updated the left property and added a transform property):
The HTML is the same as the boilerplate's and the CSS looks like a modified version but I'm not seeing anything there with any hover effect. I think the CSS I sent should work.
If not, if you could send me a link to the page I can take a look.
Thank you so much! I'll try setting the transition on the parent class instead of just the globe subclass and see if that helps. I appreciate the in-depth code snippets.