Straight to the point: I have a sidebar menu with a dropdown submenu, the folding state is defined by the css class "closed" so my question is how can I save that status to persist between views? Now when I navigate to another view the class resets to closed.
this is my View (rendered from my sidebar element):
<div id="mws-sidebar">
<div id="mws-navigation">
<ul>
<li><?php echo $this->Html->link('Clients', '/clients', array('class' => 'mws-i-24 i-group'))?></li>
<li><?php echo $this->Html->link('Transfers', '/transfers', array('class' => 'mws-i-24 i-power'))?></li>
<li><?php echo $this->Html->link('Hits', '/hits', array('class' => 'mws-i-24 i-alarm-bell-2'))?></li>
<li>
<?php echo $this->Html->link('Admin', '#', array('class' => 'mws-i-24 i-cog')); ?>
<ul class="closed">
<li><?php echo $this->Html->link('Users', '/allUsers'); ?></li>
<li><?php echo $this->Html->link('Groups', '/allGroups'); ?></li>
<li><?php echo $this->Html->link('Permissions', '/permissions'); ?></li>
</ul>
</li>
</ul>
</div>
</div>
This is the Js that toggles the submenu when the user click on the parent <li> tag:
$("div#mws-navigation ul li a, div#mws-navigation ul li span")
.bind('click', function(event) {
if($(this).next('ul').size() !== 0) {
$(this).next('ul').slideToggle('fast', function() {
$(this).toggleClass('closed');
});
event.preventDefault();
}
});
Thanks for your help, I really appreciate it in advance.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
No comments:
Post a Comment