I have a menu (vertical) that works as an accordion, this in turn, needs to open the "children" unlimited (my problem is solved, and I can not), since it will be a menu for a store. p>
As follows:
-CATEGORIA PAI
- CATEGORIA FILHO
- CATEGORIA FILHO
- CATEGORIA PAI
- CATEGORIA PAI
- CATEGORIA FILHO
- CATEGORIA FILHO
-CATEGORIA PAI
- CATEGORIA FILHO
- CATEGORIA FILHO
And for the auto and forward ...
But I'm not getting that feat ...
So, if you can, could you give me some help in this situation?
From now on I am immensely grateful.
This is my JS code (taken from NET):
// Evento de clique do elemento: ul#menu li.parent > a
$('ul#menu li.parent > a').click(function() {
// Expande ou retrai o elemento ul.sub-menu dentro do elemento pai (ul#menu li.parent)
$('ul.sub-menu', $(this).parent()).slideToggle('fast', function() {
// Depois de expandir ou retrair, troca a classe 'aberto' do <a> clicado
$(this).parent().toggleClass('aberto');
});
return false;
});
PHP:
public static function getHtmlMenu($menu){
$return = '';
foreach($menu as $m){
$class = ($m['NIVEL'] == '0') ? 'parent' : '';
$return .= '<li class="'.$class.'"><a href="'.SITEURL.'produtos/'.$m['ID'].'/'.$m['ALIAS'].'" title="'.$m['TITULO'].'">'.$m['TITULO'].'</a>'.PHP_EOL;
if(sizeof($m['SUB']) > 0){
$return .= '<ul class="sub-menu">'.PHP_EOL;
$return .= self::getHtmlMenu($m['SUB']);
$return .= '</ul>'.PHP_EOL;
}
$return .= '</li>'.PHP_EOL;
}
return $return;
}
CSS:
.parent > a {
background: url("../images/menul.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0);
color: #052754;
display: block;
font-size: 10.3px;
font-weight: bold;
height: 21px;
padding: 5px 5px 0;
text-transform: uppercase;
}
ul ul {
display: none;
}
.sub-menu > li {
background: none repeat scroll 0 0 #FFFFFF;
height: 21px;
overflow: hidden;
padding: 1px 0;
width: 243px !important;
}
.sub-menu a {
background: none repeat scroll 0 0 #FFFFFF;
border: 1px solid #CCCCCC;
color: #052754;
display: block;
font-size: 12px;
padding: 3px 0 3px 10px;
text-transform: uppercase;
}
I really forgot to report my problem. What happens is that this menu goes down only to the 2nd level, and I would like it to be "infinite". That is, if there are sub-menus it still works on JS and CSS.
As for the order of the list, it is right ... Running within PHP is as follows:
<ul><li><!--repete o <ul> anterior caso tenha novos "subs"--></li></ul>