Opening menu using hotkey

Locked
User avatar
bjorntj
Posts: 277
Joined: 30 Jul 2010, 10:46

23 Apr 2016, 21:37

Is it possible to open the main menu using p:hotkey?


Regards,

BTJ
PrimeFaces 11.x | PrimeVue 3.x | Spring Boot 2.7.x | Undertow | Mojarra 2.3.x
Mac OS, Firefox and Chromium

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

25 Apr 2016, 13:05

I think you want to open or close main menu. Right? not submenu?

Which menu position are you using? Popup or Inline

User avatar
bjorntj
Posts: 277
Joined: 30 Jul 2010, 10:46

25 Apr 2016, 13:09

The main menu yes, the one defined in layoutmenu.xhtml

I am using popup...


BTJ
PrimeFaces 11.x | PrimeVue 3.x | Spring Boot 2.7.x | Undertow | Mojarra 2.3.x
Mac OS, Firefox and Chromium

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

25 Apr 2016, 13:12

For PopUp Menu, I think you can try the following steps;

Code: Select all

var Volt = {
  
    init: function() {
       ....
    },

    ....
    
    close: function(){  /* Please ADD */
        this.menuButton.removeClass('active-menu');
        this.menuWrapper.removeClass('active-menu');
    },
    
    open: function() { /* Please ADD */
        this.menuButton.addClass('active-menu');
        this.menuWrapper.addClass('active-menu');
    }
}
Then add p:hotkeys;

Code: Select all

<p:hotkey bind="up" handler="Volt.close();" /> /* Up arrow key*/
<p:hotkey bind="down" handler="Volt.open();" /> /* Down arrow key */
it works fine for me.

User avatar
bjorntj
Posts: 277
Joined: 30 Jul 2010, 10:46

25 Apr 2016, 13:15

Ok, will try this later on. thx... :)

BTJ
PrimeFaces 11.x | PrimeVue 3.x | Spring Boot 2.7.x | Undertow | Mojarra 2.3.x
Mac OS, Firefox and Chromium

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

25 Apr 2016, 13:18

Ok, thanks :)

Locked

Return to “Volt”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests