Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Mbmenu 2Nd Level (Sub) Item - 'active' Class Is Not Added Problem

$
0
0
Hi,

I am using the MbMenu extension in my app for creating a horizontal menu with two levels.

I'd like to give an 'active' class to a second-level menu item when I am browsing the corresponding view. (Second level / row of the menu is always visible if the parent menu item is active.)

I am using the 'active' property and I have already set it to 'true' (to make sure that the item has been set to 'active' - this is of course just for testing).

Unfortunately, the 2nd level item doesn't get the 'active' class.

Here is a part of the code (protected/views/layouts/main.php):
$this->widget('ext.mbmenu.MbMenu',array(
  'activateParents'=>true,
  'items'=>array(
    array(
      'label'=>t('Produktów'), 'url'=>'/' . app()->language,
      'items'=>array(
        array('label'=>t('Kaczka'), 'url'=>array('/site/page', 'view'=>Yii::t('url','kaczka')),'active'=>true),
        array('label'=>t('Gęś'), 'url'=>array('/site/page', 'view'=>Yii::t('url','ges')),'active'=>true),

...



Any help would be greatly appreciated.

UPDATE: it seems that 'active' set the parent <li> element active only and not its child. Both <li>-s should be set to active.

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>