Jump to content

MelindaMellukas

Member
  • Posts

    16
  • Joined

  • Last visited

Posts posted by MelindaMellukas

  1. Site URL: https://cinnamon-chameleon-6wa9.squarespace.com/

    Hi, I managed to change in estonian version nicely but english version it changes all the time to "Kontakt" to "Contact" visbily:

    https://cinnamon-chameleon-6wa9.squarespace.com/en/home

     

    Code I used:

     /* ADD EXCLUSION NAV ITEMS */
      $('.exclude-me,.exclude-me a').addClass('exclude');
      $('.sqs-svg-icon--list a,.SocialLinks-link').addClass('exclude');
    });
        $(document).ready(function(){
        $("body.body-en a.btn").html(function() { 
              return $(this).html().replace("Kontakt", "Contact");  
        });
      $("body.body-en a.btn").attr('href','/en/contact');
            });
    </script>

     

     

  2. Site URL: https://cinnamon-chameleon-6wa9.squarespace.com/

    Hi,

    I used on footer this code and it worked well in the estonian version https://cinnamon-chameleon-6wa9.squarespace.com/et/blogi

    </script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script>
    $('.blog-more-link:contains("Read More")').text('Loe rohkem'); 
    </script>
    <style>

     

    However, how do I keep Read more in the English version?

    https://cinnamon-chameleon-6wa9.squarespace.com/en/blog

  3. 2 hours ago, tuanphan said:

    Try adding this to Design > Custom CSS

    /* Nav links flash */
    .header-nav-list {
      visibility: hidden;
    }
    .header-nav-list .multilanguage {
      visibility: visible;
    }

     

    I couldnt get it working like this or im missing smth from the code. Problem is its changing visbily Kontakt to Contact in sthe english menu if you navigate between menu items. https://cinnamon-chameleon-6wa9.squarespace.com/

     
  4. Hi, Thank you! I got it working but when you click on english version menu, its a bit flashy, going quickly from Kontakt to Contact: https://cinnamon-chameleon-6wa9.squarespace.com

     

    My code:

     

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script>
      $(function() { 
      /* SETUP MULTI-LANGUAGE */
      var defaultLanguage = 'et';
      var lang = location.pathname.split("/")[1];
      var defaultClass = 'lang-'+defaultLanguage+'';
      var itemParent = "nav [class*='collection'],nav [class*='folder'],nav [class*='index'],nav [class*='group']";
      if (lang == "et" || lang.length > 2 ){
        var lang = defaultLanguage;
      }

      /* ADD LANGUAGE CLASSES */
      $('a[href="/"]').addClass('lang-'+defaultLanguage+'').parents(itemParent).addClass('lang-'+defaultLanguage+'');
      $('nav a:link:not([href^="http://"]):not([href^="https://"])').each(function () {
        var langType = $(this).attr('href').split("/")[1];
        var multiLanguageClass = 'multilanguage lang-' + langType + '';
        if (undefined !== langType && langType.length <= 2) 
          $(this).addClass(multiLanguageClass).parents(itemParent).addClass(multiLanguageClass);
      });
      $('nav button').each(function () {
        var langTypeFolder = $(this).attr('data-controller-folder-toggle').split("/")[0];
        var multiLanguageClass = 'multilanguage lang-' + langTypeFolder + '';
        if (undefined !== langTypeFolder && langTypeFolder.length <= 2) 
          $(this).addClass(multiLanguageClass);
      });
       /* HOMEPAGE-LOGO LINKS TO PROPER LANGUAGE HOMEPAGE */
    if (lang == "en") {
    $('a[href="/"]').attr("href", "/en/home");
      $('body').addClass("body-en");
    }
    if (lang == "et") {
    $('a[href="/"]').attr("href", "/et/home");
      $('body').addClass("body-et");
    }
     /* ADD EXCLUSION NAV ITEMS */
      $('.exclude-me,.exclude-me a').addClass('exclude');
      $('.sqs-svg-icon--list a,.SocialLinks-link').addClass('exclude');
    });
        $(document).ready(function(){
        $("body.body-en a.btn").html(function() { 
              return $(this).html().replace("Kontakt", "Contact");  
        });
      $("body.body-en a.btn").attr('href','/en/contact');
            });
    </script>

  5. I put this code to footer. It prevents going back to cover page BUT when clicking home button it doesnt stay at the language, it goes back to the default langeage. 

     

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script>
      $(function() { 
      /* SETUP MULTI-LANGUAGE */
      var defaultLanguage = 'et';
      var lang = location.pathname.split("/")[1];
      var defaultClass = 'lang-'+defaultLanguage+'';
      var itemParent = "nav [class*='collection'],nav [class*='folder'],nav [class*='index'],nav [class*='group']";
      if (lang == "en" || lang.length > 2 ){
        var lang = defaultLanguage;
      }

      /* ADD LANGUAGE CLASSES */
      $('a[href="/"]').addClass('lang-'+defaultLanguage+'').parents(itemParent).addClass('lang-'+defaultLanguage+'');
      $('nav a:link:not([href^="http://"]):not([href^="https://"])').each(function () {
        var langType = $(this).attr('href').split("/")[1];
        var multiLanguageClass = 'multilanguage lang-' + langType + '';
        if (undefined !== langType && langType.length <= 2) 
          $(this).addClass(multiLanguageClass).parents(itemParent).addClass(multiLanguageClass);
      });
      $('nav button').each(function () {
        var langTypeFolder = $(this).attr('data-controller-folder-toggle').split("/")[0];
        var multiLanguageClass = 'multilanguage lang-' + langTypeFolder + '';
        if (undefined !== langTypeFolder && langTypeFolder.length <= 2) 
          $(this).addClass(multiLanguageClass);
      });

      /* HOMEPAGE-LOGO LINKS TO PROPER LANGUAGE HOMEPAGE */
      if (lang == "et") {
        $('a[href="/"]').attr("href", "/et/home");
      }
        if (lang == "en") {
        $('a[href="/"]').attr("href", "/en/home");
      }
     /* ADD EXCLUSION NAV ITEMS */
      $('.exclude-me,.exclude-me a').addClass('exclude');
      $('.sqs-svg-icon--list a,.SocialLinks-link').addClass('exclude');
    });
    </script>

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