jQuery Mega 菜单闪烁问题
我想知道是否有人能够阐明我遇到的问题...
我在以下网站使用了 jQuery Mega 菜单脚本:
http://www.furnituremind.co.uk/
我从以下站点找到了脚本:
http://designchemical.com/lab/jquery-mega-drop- down-menu-plugin/examples/
问题是在加载时,我可以看到文本以未格式化的方式快速闪烁,如下图所示:
http://img838.imageshack.us/img838/4421/screenshot20111221at193.png
我正在寻找寻找解决此问题的方法,但我不确定从哪里开始。我检查了开发者网站、评论和谷歌,但找不到解决方案。我想也许可以将其放置在临时隐藏的 Div 中,直到加载脚本。
非常感谢帮助!
I wonder if anyone might be able to shed some light on a problem I'm having...
I have used a jQuery Mega Menu script for the below website:
http://www.furnituremind.co.uk/
I found the script from the below site:
http://designchemical.com/lab/jquery-mega-drop-down-menu-plugin/examples/
The problem is that on loading, I can see the text flash quickly in an unformatted fashion as shown in the below picture:
http://img838.imageshack.us/img838/4421/screenshot20111221at193.png
Im looking for a way to fix this, but am unsure where to start. I've checked around the developers site, comments and Google but can't find a solution. Im thinking maybe there's a to place it in a temporarily hidden Div until the script is loaded.
Help is very much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我认为这个问题是因为 html 加载然后 jquery 插件运行而引起的。我在 ui 选项卡和 jquery 表单向导上看到了这种情况(例如:http://thecodemine.org/)。
我不认为你可以让 jquery 绑定比文档准备得更快。我建议的一件事是使用 css (display: none;) 隐藏这些子菜单,这样它们就会被隐藏,并且您不会看到它们闪烁。
I think that problem is caused because the html loads up and then the jquery plugin gets run. I seen this happen on u.i tabs and jquery form wizard(like: http://thecodemine.org/).
I don't think you can get jquery to bind any faster than document ready. The one thing I suggest is hide those sub menus by using css (display: none;) that way they will be hidden and you won't see them flash.
chobo2 是正确的。
您可以使用初始化菜单时添加的大型菜单类,然后在菜单形成后取消隐藏它们:
main-mega li ul, #nav-main-mega .sub {display: none;}
main-mega .sub ul {显示:块;}
chobo2 is correct.
You can use the mega menus classes that are added when the menu is initialised to then unhide them after the menu has formed:
main-mega li ul, #nav-main-mega .sub {display: none;}
main-mega .sub ul {display: block;}
您可以在加载之前使用 CSS 隐藏子菜单:
You can use CSS to hide the sub-menus prior to loading:
我遇到了同样的问题。我通过将其添加为有关大型菜单的任何 CSS 的第一行来使菜单停止闪烁:
I came across this same issue. I got the menu to stop the flicker by adding this as the first line of any CSS regarding the mega menu:
将其作为第一行添加到您用于大型菜单的 CSS 文件中:
然后添加一些 jQuery 以在文档就绪时再次显示该项目:
这将消除闪烁。
我尝试了这里的所有解决方案,但没有一个对我来说 100% 有效。这在 IE11 中是这样的。
Add this as the first line to the CSS file you are using for the mega menu:
Then add some jQuery to show that item again on doc ready:
This will remove the flicker.
I tried every soltion here none worked 100% for me. This does in IE11.
在菜单 CSS 的第一行,您必须使用以下行:-
At the First Line of Menu CSS you have to use following lines:-