• Hello and thanks for the plugin

    I have several ids for menus with languages (different for each language) . I have added them in “Add the Menu CSS Class or ID to be used as SickNav Menu, comma separate multiple menus” but only first is working.

    To be able to work in all of them I had to change slick-init.js because you append and the ng_slicknav_menu when it has not length :

        if ( ng_slicknav_menu_arr.length > 1 ) {
            // multiple comma seperated selectors
            // based on https://codepen.io/ComputerWolf/pen/tjyIg
            // clone all menus to keep them 
            ng_slicknav_menu = $( ng_slicknav_menu_arr[0].trim() ).clone();
            for ( var i = 1; i < ng_slicknav_menu_arr.length; i++ ) {
                var ng_slicknav_other = $( ng_slicknav_menu_arr[i].trim() ).clone();
                  ng_slicknav_other.children( 'li' ).appendTo( ng_slicknav_menu );
            }
    
    //NEW CODE
        if ( ng_slicknav_menu_arr.length > 1 ) {
            // multiple comma seperated selectors
            // based on https://codepen.io/ComputerWolf/pen/tjyIg
            // clone all menus to keep them 
            ng_slicknav_menu = $( ng_slicknav_menu_arr[0].trim() ).clone();
            for ( var i = 1; i < ng_slicknav_menu_arr.length; i++ ) {
                var ng_slicknav_other = $( ng_slicknav_menu_arr[i].trim() ).clone();
    
    //CHANGED CODE
                if(ng_slicknav_menu.length == 0){
                  ng_slicknav_menu =$( ng_slicknav_menu_arr[i].trim() ).clone();
                }else{
                  ng_slicknav_other.children( 'li' ).appendTo( ng_slicknav_menu );
                }
            }
    

    I hope that you find it useful and change it in your code ??

    • This topic was modified 6 months, 3 weeks ago by 2candela2.
  • The topic ‘Correct the slick-init.js to have several ids’ is closed to new replies.