Hello everyone.
Can you, please, help me solve one problem?
This code
$this->widget('zii.widgets.CMenu', array(
'items'=>array(
array('label'=>'Item1', 'url'=>array('site/index')),
array('label'=>'Item2', 'url'=>"#", 'linkOptions'=>array('id'=>'myId1'),'submenuOptions'=>array('id'=>'myId'),'items'=>array(
array('label'=>'SubItem1', 'url'=>array('site/anot','id'=>'9')),
array('label'=>'SubItem2', 'url'=>array('site/anot','id'=>'10')),
)),
),
));
alongside with some javascript
$("#myId1").click(function()
{
$("#myId").slideToggle();
});
and css
#myId
{
display: none;
}
give me a little menu in which when I click ‘Item2’ two sibitems appear.
The problem is when I click, for example, ‘SubItem1’ the corresponding page is loaded but Item2 is not expanded any more, that is my subitems hide away. Though when I click Item2 again I can see that ‘SubItem1’ is active.
In plain html it looks like
<ul id="yw3">
<li><a href="/predmety/index.php?r=site/index">Item1</a></li>
<li><a id="myId1" href="#">Item2</a>
<ul id="myId">
<li class="active"><a href="/predmety/index.php?r=site/anot&id=9">SubItem1</a></li>
<li><a href="/predmety/index.php?r=site/anot&id=10">SubItem2</a></li>
</ul>
</li>
</ul>
How active class can be applied to <ul id="myId">?