Some of my menu items are just Ajax updates, how to collapse the menu from code (like clicking on the hamburger icon) because the page isn't reloaded the menu keeps unfolded after clicking the menu item.
Thanks in advance,
Arco
Collapse menu from code
Forum rules
Please note that response time for technical support is within 3-5 business days.
Please note that response time for technical support is within 3-5 business days.
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Please try;
Code: Select all
<pa:tabMenu widgetVar="myTabMenu">
....
<p:submenu ...>
<p:menuitem onclick="closeMenu()" .../>
</p:submenu>
...
</pa:tabMenu />
//JS code
<script type="text/javascript">
function closeMenu() {
var $this = PF('myTabMenu');
if($this) {
$this.tabMenu.find('.menu-button').trigger('click');
}
}
</script>
Github Profile: https://github.com/mertsincan
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Glad to hear, thanks for the update!
Github Profile: https://github.com/mertsincan
-
- Information
-
Who is online
Users browsing this forum: No registered users and 13 guests