如何摆脱难看的ASP:菜单闪烁? [英] How to get rid of ugly asp:Menu flickering?

查看:281
本文介绍了如何摆脱难看的ASP:菜单闪烁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了 ASP:

I'm using the asp:Menu control on an ASP.NET 4.0 Webforms page with table-free rendering mode:

<asp:Menu ID="MenuBase" runat="server" DataSourceID="SiteMapDataSourceMenu"
    Orientation="Horizontal" CssClass="contentmenu" RenderingMode="List" 
    IncludeStyleBlock="false">
</asp:Menu>

菜单上有一个水平主一行5或6个菜单项,其中一些开放垂直弹出菜单,当用户将鼠标悬停在他们。

The menu has a horizontal main row with 5 or 6 menu items and some of them open vertical popup menus when the user hovers over them.

通常,当任何回发发生并且页面获取呈现再次菜单闪烁的时刻(例如,半秒),这意味着:所有的菜单项 - 包括在弹出菜单中的项目 - 被显示在一个或多个行一个接对方才恢复到正常预期状态。

Often when any postback occurs and the page gets rendered again the menu "flickers" for a moment (say, half a second) which means: All menu items - including the items in the popup menus - are displayed in one or more rows one after each other before they return to the normal intended state.

在这短短的所有菜单项菜单看起来好像JavaScript从一开始在浏览器中被禁用的展开显示的时刻。 (看来,建设弹出菜单是由ASP中使用一些JavaScript来实现:菜单控制)

In this short moment of an "unfolded" display of all menu items the menu looks AS IF Javascript had been disabled in the browser. (It seems that building the popup menus is achieved by using some Javascript in the asp:menu control.)

此行​​为是相当难看,尤其是一个大菜单(呈现为短暂的瞬间超过2或3行)整个页面内容下移它跳回正常显示了。

This behaviour is quite ugly, especially with a big menu (rendering for the short moment over 2 or 3 rows) the whole page content is moved down before it jumps back to normal display.

你知道这个问题的任何解决方案?

Do you know any solution for this problem?

感谢你在前进!

(注:我要指出,我使用codePLEX知名CSS友好的菜单控制之前我升级到ASP.NET 4.0我认为我不需要CSS友好的控制了,因为。在asp:。在菜单4版本提供了内置列表渲染模式,现在据我记得我没有这个闪烁与CSS友好的控制,我认为这种控制不使用的Javascript也许这是一个坏的一步。我现在寻找一个解决方案,而无需返回到CSS友好的菜单控制,如果可能的话)。

(Remark: I should mention that I used the well-known CSS-friendly menu control from CodePlex before I upgraded to ASP.NET 4.0. I supposed that I don't need the CSS-friendly control anymore because the asp:Menu in version 4 offers a built-in List rendering mode now. As far as I remember I didn't have this flickering with the CSS-friendly control and I think this control does not make use of Javascript. Perhaps this was a bad step. I am looking now for a solution without going back to the CSS-friendly menu control, if possible.)

编辑:

这闪烁是独立于浏览器,但最引人注目的在IE 8和7的IE 7(或IE 8兼容模式)这是非凡的丑陋,因为菜单项获得甚至超过5或6行显示在一个疯狂的对角线模式。

This flickering is browser independent, although most noticeable in IE 8 and 7. In IE 7 (or Compatibility mode in IE 8) it's extraordinary ugly since the menu items get displayed in a crazy diagonal pattern even over 5 or 6 rows.

推荐答案

如果有人仍然需要一个解决方案;闪烁的是,因为你应该设置正确的显示样式在CSS的菜单。

If anyone still needs a solution; the flickering is there because you should set the correct display style in your css for the menu.

尝试例如:

#menu ul li ul
{
    display: none;
}

#menu ul li 
{
    position: relative; 
    float: left;
    list-style: none;
}

闪烁的是因为ASP.NET 4菜单使用JavaScript来设置一些内嵌样式。

The flickering is because the ASP.NET 4 menu uses javascript to set some inline styles.

这篇关于如何摆脱难看的ASP:菜单闪烁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆