WebsiteBaker Community Forum
		WebsiteBaker Support (2.12.x) => General Help & Support => Topic started by: rumen on June 11, 2020, 08:17:05 AM
		
			
			- 
				Hi there, 
I wounder if I can use a "sticky" menu option in WB and I try on good menu, but whatever I try I loose the dropdown and the sticky.  Attached all files.  I try many hours to make it but can't make it work until now. The code last try is:
<?php 
			$open = '<li class="[if(class=menu-parent){active}]'
                .   '[if(class==menu-expand){hassubs}]">'
                .   '[if(class==menu-expand)'
                    .   '{<a href="[url]" class="">[menu_title]<b class="caret"></b> <i class="fa fa-chevron-down"></i></a>}'
                . 'else'
                    .   '{<a href="[url]">[menu_title]</a>}'
                . ']';
			echo show_menu2(
				$aMenu          = 1,
				$aStart         = SM2_ROOT+$iMultiLang, 
				$aMaxLevel      = SM2_CURR+2,
				$aOptions       = SM2_ALL|SM2_PRETTY,
				$aItemOpen      = $open,
				$aItemClose     = '</li>',
				$aMenuOpen      = '<ul>',
				$aMenuClose     = '</ul>',
				$aTopItemOpen   = false,
				$aTopMenuOpen   = '<ul class="menu vertical medium-horizontal">'
			);?>
			 
			
			- 
				Hi, if you want use own scripts like 
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>You have to deactivate the lineregister_frontend_modfiles('jquery');And you have to check the filter "RegisterModFiles" in Admin-Tools > Output Filter Frontend
It is not easy to use, i know. 
Check the checkbox "RegisterModFiles" means: 
- use the template like in old times. 
- ignore the filter "Jquery". 
- Use the register_frontend_m odfiles('xxx') in the index.php.
Mouseover on this filter should display some more informations.
In this moment it looks for me so: you haven't checked the checkbox RegisterModFiles. The filter Jquery is checked and load jQuery.Also your line with jquery-2.2.4 is active. So you have 2 times jquery loaded, and this is not good.
Hope it helps.
			 
			
			- 
				Hi there,
I sent the original files, in the system I have all that in place see here (https://prnt.sc/sxqg5p) and here (https://prnt.sc/sxqi4g).
It is free menu script and looks nice. Anyone can use it and that's why I try to make it works, so any of us here can use it some day if need. So far unfortunately no any success. 
			 
			
			- 
				
 but whatever I try I loose the dropdown and the sticky.  
The css classes of everything belonging to the dropdown are not declared, as far as I can see on the first look.
			 
			
			- 
				Maybe it was a misunderstanding.
Not deactivate your line with jquery-2.2.4.
Deactivate the lineregister_frontend_modfiles('jquery');
The order of the scripts is important.
First jQuery, then the rest of the JS.
			 
			
			- 
				Yep! Now the "sticky" function works (http://zapryanov.faith/cloud/index.php/s/pMNxiY8GmLdbFpG). Only the dropdown should be fixed. I can upload it like that now the full here (as template with index.php, info.php, CSS and JS) so everyone can download, but need to fix the dropdown. I have no idea why doesn't work. Probably some of the classes ... The CSS is based on "foundation" and it is full - has grid, buttons, tables etc ... need small customization as needs of the site. 
			
 
			
			- 
				Attached the template. Only dropdown doesn't work. If anyone find the problem - please share to correct. 
Thanks dbs for the help! 
Appreciate!
Regards, 
Rumen
			 
			
			- 
				You have a link to the original site where dropdown works?
For me it looks like no function for dropdown is implemented.
Only sticky menu is present. And a toggle class for the mobile menu button.
			 
			
			- 
				Line 2158 to 2408 in the CSS file - foundation.css (attached in the zip file I uploaded early) is the dropdown menu. Active with <li>
			
 
			
			- 
				Try this (seen here https://get.foundation/sites/docs/dropdown-menu.html)
             <?php 
            $open = '<li class="[class]"><a href="[url]">[menu_title]</a>';
            
            echo show_menu2(
                $aMenu          = 1,
                $aStart         = SM2_ROOT+$iMultiLang, 
                $aMaxLevel      = SM2_CURR+2,
                $aOptions       = SM2_ALL,
                $aItemOpen      = $open,
                $aItemClose     = '</li>',
                $aMenuOpen      = '<ul class="menu">',
                $aMenuClose     = '</ul>',
                $aTopItemOpen   = false,
                $aTopMenuOpen   = '<ul class="dropdown menu" data-dropdown-menu>'
            );?>
			 
			
			- 
				I confirm it work! Just note - if anyone use the template should not put more then 4 things in the menu!!! The mobile menu doesn't transform the menu from horizontal to vertical and if there are more then 4 or 5 things they go out of the page. Look here (http://zapryanov.faith/cloud/index.php/s/6cZS7x9Wb8JeDJe)
Everything else works fine! In the video the button of the "MENU" in the mobile version doesn't change properly but that's only in the video maybe a conflict with the video recording application.
			 
			
			- 
				OK I found the issue with the vertical menu in mobile version it is the additional class in the UL  here i sthe menu:
 <?php 
            $open = '<li class="[class]"><a href="[url]">[menu_title]</a>';
            
            echo show_menu2(
                $aMenu          = 1,
                $aStart         = SM2_ROOT+$iMultiLang, 
                $aMaxLevel      = SM2_CURR+2,
                $aOptions       = SM2_ALL,
                $aItemOpen      = $open,
                $aItemClose     = '</li>',
                $aMenuOpen      = '<ul class="menu">',
                $aMenuClose     = '</ul>',
                $aTopItemOpen   = false,
                $aTopMenuOpen   = '<ul class="vertical medium-horizontal menu" data-responsive-menu="accordion medium-dropdown" >'
            );?>
Now it works perfect!
			 
			
			- 
				Good job, it works.  (Y)