Grails UI 菜单在 IE 中的不稳定行为

发布于 2024-08-23 20:56:05 字数 1437 浏览 4 评论 0原文

我正在使用 GRAILS UI (1.2-SNAPSHOT),它是 YUI 菜单栏 (YUI 2.7.0.1) 的实现。我在 IE 中看到不稳定的鼠标悬停行为(Firefox 没问题)。当我将鼠标悬停在带有子菜单的菜单项上时,它将显示。当我尝试将鼠标悬停在子菜单上时,在我单击之前子菜单就消失了。这种情况发生的模式我还没有完全弄清楚。通常,当我第一次选择菜单时,这很好,但如果我将菜单移回到菜单项,子菜单就会开始显示此行为。通过单击并按住鼠标按钮,我通常可以让子菜单保留下来。

我已经尝试过各种配置,例如 keepopen 和 automenudisplay ,但它们似乎并没有改变行为。我还没有看到太多关于此的帖子。但我也没有在 UI 插件中看到菜单记录。如果 UI 菜单还没有准备好进入黄金时段或者我错过了其他东西,我真的可以使用一些反馈。我以前很少使用过 AJAX。

下面是我使用过的添加选项的代码,但没有产生积极的影响。

<gui:menubar id='menubar' renderTo='mainmenu' autosubmenudisplay="false" shadow="true" keepopen="true">
<gui:menuitem url="/esmzone">Home</gui:menuitem>
        <gui:submenu label='Profile'>
            <gui:menuitem url="${createLink(controller:'memberProfile', action:'view')}">View</gui:menuitem>
            <gui:menuitem url="${createLink(controller:'memberProfile', action:'profile')}">Edit</gui:menuitem>
            <gui:menuitem url="${createLink(controller:'user', action:'account')}">Settings</gui:menuitem>
            <gui:menuitem url="#">Subscription</gui:menuitem>
        </gui:submenu>

这是插件生成的代码:

<script>
YAHOO.util.Event.onDOMReady(function() {
    GRAILSUI.menubar = new YAHOO.widget.MenuBar("menubar_div", {'autosubmenudisplay':  false,
'shadow': true,
'keepopen': true});
    GRAILSUI.menubar.render('mainmenu');
});
</script>

I'm using a GRAILS UI (1.2-SNAPSHOT) an it's implementation of the YUI menubar (YUI 2.7.0.1). I am seeing flakey mouseover behavior in IE (Firefox is ok). When I mouse over the menu item with a submenu, it will show. As I try to mouse over the sub-menu, the submenu disappears before I can click. This happends in a pattern I haven't fully figured out. Usually the first time I select a menu it's fine but if I move around the menu back to a menu item, the submenu begins to display this behavior. By clicking and holding the mouse button I can usually get the sub-menu to stick around.

I've palyed with various configurations like keepopen and automenudisplay but they don't seem to change the behavior. I have not seen much posted about this. But I also don't see menu's documented in the UI plugin either. I could really use some feedback if UI menu is not ready for primetime yet or I'm missing something else. I've not worked with much AJAX before.

Below is the code with the added options I played with that did not have a positive impact.

<gui:menubar id='menubar' renderTo='mainmenu' autosubmenudisplay="false" shadow="true" keepopen="true">
<gui:menuitem url="/esmzone">Home</gui:menuitem>
        <gui:submenu label='Profile'>
            <gui:menuitem url="${createLink(controller:'memberProfile', action:'view')}">View</gui:menuitem>
            <gui:menuitem url="${createLink(controller:'memberProfile', action:'profile')}">Edit</gui:menuitem>
            <gui:menuitem url="${createLink(controller:'user', action:'account')}">Settings</gui:menuitem>
            <gui:menuitem url="#">Subscription</gui:menuitem>
        </gui:submenu>

Here is the code generated by the plugin:

<script>
YAHOO.util.Event.onDOMReady(function() {
    GRAILSUI.menubar = new YAHOO.widget.MenuBar("menubar_div", {'autosubmenudisplay':  false,
'shadow': true,
'keepopen': true});
    GRAILSUI.menubar.render('mainmenu');
});
</script>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人生戏 2024-08-30 20:56:05

我通过研究 YUI 库在这方面取得了一些进展。 IE7 存在一个已记录的错误。显然 grails-ui 插件没有解决这个问题。我正在使用 IE8 进行测试,但我认为它仍然存在。

http://developer.yahoo.com/yui/menu/#knownissues

看来您应该将 bd 类的 Zoom 属性设置为 1 (zoom:1)。
我将以下代码添加到我的样式表中

div.yuimenubar .bd {
zoom: 1;
}

,它似乎有帮助。我在 Firefox 中没有看到任何副作用,但我没有动态检查浏览器的版本,因为我需要破解生成 YUI javascript 的代码并

if (YAHOO.env.ua.ie === 7) {
YAHOO.util.Dom.addClass(document.body, "ie7");
}

在 render() 调用之后放入。然后,您可以使用 IE7(可能 >=7)样式来代替我添加的样式。

雅虎网站对此是这样说的:

以下应用
“zoom:1”设置“hasLayout”
属性为“true”并防止
MenuBar 的第一层子菜单
当鼠标移动时隐藏
从 MenuBar 中的项目到
IE 7 中的子菜单。
有关“hasLayout”属性的更多信息:
http://msdn.microsoft.com/en-us /library/ms533776(VS.85).aspx

I made some progress on this by researching the YUI library. There is a documented bug with IE7. Apparently the grails-ui plugin does not address the fix. I'm testing with IE8 but I assume it's still there.

http://developer.yahoo.com/yui/menu/#knownissues

It appears that you should set the zoom property to 1 (zoom:1) for the bd class.
I added the following code to my style sheet

div.yuimenubar .bd {
zoom: 1;
}

and it seems to help. I see no side effect in Firefox but I didn't dynamically check for the version of browser as I would need to hack the code that generates the YUI javascript and put in

if (YAHOO.env.ua.ie === 7) {
YAHOO.util.Dom.addClass(document.body, "ie7");
}

after the render() call. Then instead of the style I added you could do an IE7 (probably >=7) style.

This is what the Yahoo site had to say about it:

The following application of
"zoom:1" sets the "hasLayout"
property to "true" and prevents
first tier submenus of a MenuBar
from hiding when the mouse is moving
from an item in a MenuBar to a
submenu in IE 7.
For more on the "hasLayout" property:
http://msdn.microsoft.com/en-us/library/ms533776(VS.85).aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文