How to get rid of ugly asp:Menu flickering?

后端 未结 12 1219
遥遥无期
遥遥无期 2020-12-24 14:37

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



        
12条回答
  •  南笙
    南笙 (楼主)
    2020-12-24 15:18

    I tried the ideas above (with variations) and some fixed the odd rendering (the flicker as it were) but they all caused regressions (example submenus that would render too far away and fly away when you move to them).

    Inspired by an idea on another thread, I tried something different: hide the menu initially and unhide it once the page has loaded.

    Step by step: I have an invisible class invButton I already had and use for hiding buttons, etc.

    
    

    Next I set the CssClass of the offensive flickering menu to CssClass="invButton", so it starts invisible.

    
    

    Finally, once the page hits '$(document).ready' I remove the class.

    
    

    Voila, menu renders nicely in correct format and no weird flickering at load up.

提交回复
热议问题