JSF PrimeFaces MenuBar dropdown submenu disapearing after hover in p:layout

偶尔善良 提交于 2019-12-07 14:51:04

问题


Doing some application in JSF PrimeFaces 3.1.1 (still learning) and I implemented full page layout - Sunny (the <p:layout /> tag). Everytihng is fine, except my menu bar.

On hover on the submenu button in the menu, the dropdown submenu shows, but when I want to go by mouse to the submenu, it disappears. The only option is to change the mouse position to the submenu very fast - than it stays. And thats the problem, need it to work normally, not dissappearing.

If I put the layouts out, the menubar works well again. Also tried to copy & paste code from PF showcase, issue was the same.

Using JSF 2 on Tomcat 7.0.22.0. Here is something of my code...

The menubar in a template:

<p:layoutUnit position="north" size="130">
    <ui:insert name="top">
        <p:menubar id="mainMenu" model="#{menu.mainMenu}" />
    </ui:insert>
</p:layoutUnit>

The CSS solving overflow problems:

.ui-layout-north .ui-layout-unit-content {
    overflow: visible !important;
}

.ui-layout-north {
    z-index: 30 !important;
    overflow: visible !important;
}

Thanks for help!


回答1:


Did you happen to set a custom font size for your ui-widget? Personally, I had the following CSS setting:

.ui-widget {
    font-size: 12px !important;
}

and I experienced similar issue like yours in Firefox (but not in Chrome). Oddly enough, after increasing font-size to 13px the problem was fixed.




回答2:


The menubar works in IE or Chrome but in firefox don't show correctly you can see that in Check this with firefox a see what happen :)

I solve this problem with

    .ui-menubar .ui-menuitem-text {
    font-size: 13px!important; top: -1px;
}



回答3:


This is not ideal but it solved the problem for me:

.ui-menuitem-link
{
    max-width: 180px;
}



回答4:


Please view next link http://forum.primefaces.org/viewtopic.php?f=3&t=16597.

It's a matter of font with.

This appear also in Firefox 27 and Prime Faces 4.0 RC.

In other browsers works well.



来源:https://stackoverflow.com/questions/9557106/jsf-primefaces-menubar-dropdown-submenu-disapearing-after-hover-in-playout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!