WebsiteBaker Community Forum

WebsiteBaker Support (2.12.x) => General Help & Support => Topic started by: rumen on June 11, 2020, 08:17:05 AM

Title: Question about "sticky" option of menu within SM2 in WB
Post 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:

Code: [Select]
<?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">'
);?>
Title: Re: Question about "sticky" option of menu within SM2 in WB
Post by: dbs on June 11, 2020, 09:33:25 AM
Hi, if you want use own scripts like
Code: [Select]
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>You have to deactivate the line
Code: [Select]
register_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.
Title: Re: Question about "sticky" option of menu within SM2 in WB
Post by: rumen on June 11, 2020, 10:20:30 AM
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.
Title: Re: Question about "sticky" option of menu within SM2 in WB
Post by: LudwigSt on June 11, 2020, 11:24:15 AM
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.
Title: Re: Question about "sticky" option of menu within SM2 in WB
Post by: dbs on June 11, 2020, 11:31:23 AM
Maybe it was a misunderstanding.
Not deactivate your line with jquery-2.2.4.
Deactivate the line
Code: [Select]
register_frontend_modfiles('jquery');
The order of the scripts is important.
First jQuery, then the rest of the JS.
Title: Re: Question about "sticky" option of menu within SM2 in WB
Post by: rumen on June 11, 2020, 04:10:15 PM
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.
Title: Re: Question about "sticky" option of menu within SM2 in WB
Post by: rumen on June 11, 2020, 08:13:43 PM
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
Title: Re: Question about "sticky" option of menu within SM2 in WB
Post by: dbs on June 11, 2020, 09:08:01 PM
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.
Title: Re: Question about "sticky" option of menu within SM2 in WB
Post by: rumen on June 12, 2020, 01:20:12 AM
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>
Title: Re: Question about "sticky" option of menu within SM2 in WB
Post by: dbs on June 12, 2020, 07:52:19 AM
Try this (seen here https://get.foundation/sites/docs/dropdown-menu.html)
           
Code: [Select]
<?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>'
            
);?>
Title: Re: Question about "sticky" option of menu within SM2 in WB
Post by: rumen on June 12, 2020, 10:18:06 AM
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.
Title: Re: Question about "sticky" option of menu within SM2 in WB
Post by: rumen on June 12, 2020, 10:30:58 AM
OK I found the issue with the vertical menu in mobile version it is the additional class in the UL  here i sthe menu:

Code: [Select]
<?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!
Title: Re: Question about "sticky" option of menu within SM2 in WB
Post by: dbs on June 12, 2020, 12:04:45 PM
Good job, it works.  (Y)