Results 1 to 2 of 2

Thread: JQuery Submenu messed up (Weebly)

Hybrid View

  1. #1
    Join Date
    Feb 2014

    Question JQuery Submenu messed up (Weebly)

    I am designing a website with the CMS of Weebly. Unfortunately Weebly doesn't support multilingual websites, so I had to do it with JQuery. I found a script at http://blessingsweb.weebly.com/1/pos...th-weebly.html and added it to my website. The script hides the German menus, when you are on the English website and hides the English menus, when you are on the German Website. Everything is working, apart from the submenu on the German website. Somehow the script changed the position of the submenu and also the direction of the slide from left to right, to top to bottom.

    Demo: http://mop000.weebly.com/startseite.html as you can see, the submenu has some strange behaviour.

    If you click on the flag, you will see that on the English site everything is working well.

    What can I do?

    Code added as languages-1.0.js-file:

    function hideMenus() {
    lang = language.toLowerCase();
    console.log('LANG: ' + lang);
    currentLang = null;
    menus = jQuery(menuSelector + ' ul li').each(function(){
        menu = jQuery(this);
        a = menu.children('a');
        span = a.children('span');
        if (span.length == 0) text = a.html();
        else text = span.html();
        text = text.toLowerCase();
        if (langs[text] != null) {
            currentLang = langs[text].toLowerCase();
            if (currentLang == lang) { 
                //if this is the first page of this language, we set the logo to go to this page url
                jQuery('.wsite-logo a').attr('href', a.attr('href'));
        show = (currentLang == lang);
        if (show) menu.show(); else menu.hide();
      console.log('MENU:' + text + ' - current lang: ' + currentLang + ' - in langs '+ langs[text] + ' - '+ (show ? 'SHOW' : 'HIDE'));

    Code added in the header (SEO) of the website:

    <script src="/files/theme/jquery-1.10.2.min.js"></script>
    <script src="/files/theme/languages-1.0.js"></script>
    langs = {          //everything in langs must be in lowercase
        'home': 'en',
        'startseite': 'de'
    menuSelector = '#avmenu'; 

    Code added on the German pages:

    <script> language = 'de'; </script>
    Code added on the English pages:

    <script> language = 'en'; </script>
    That's it. Thanks in advance!

  2. #2
    Join Date
    Mar 2007
    STOP using $ prefix on JavaScript variable names...
    Please remember to wrap any code you have in forum tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles