jQuery Mega 菜单闪烁问题

发布于 2024-12-22 12:30:59 字数 699 浏览 5 评论 0原文

我想知道是否有人能够阐明我遇到的问题...

我在以下网站使用了 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 技术交流群。

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

发布评论

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

评论(6

怀念你的温柔 2024-12-29 12:30:59

我认为这个问题是因为 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.

绮烟 2024-12-29 12:30:59

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;}

青巷忧颜 2024-12-29 12:30:59

您可以在加载之前使用 CSS 隐藏子菜单:

#menu li ul {display: none;}
#menu .sub ul {display: block;}

You can use CSS to hide the sub-menus prior to loading:

#menu li ul {display: none;}
#menu .sub ul {display: block;}
说好的呢 2024-12-29 12:30:59

我遇到了同样的问题。我通过将其添加为有关大型菜单的任何 CSS 的第一行来使菜单停止闪烁:

.megamenu li > div {display: none}

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:

.megamenu li > div {display: none}
我不会写诗 2024-12-29 12:30:59

将其作为第一行添加到您用于大型菜单的 CSS 文件中:

.mega-menu li > div {display: none}

然后添加一些 jQuery 以在文档就绪时再次显示该项目:

$(document).ready(function () {
    $('.mega-menu li > div').css('display', 'block');
});

这将消除闪烁。
我尝试了这里的所有解决方案,但没有一个对我来说 100% 有效。这在 IE11 中是这样的。

Add this as the first line to the CSS file you are using for the mega menu:

.mega-menu li > div {display: none}

Then add some jQuery to show that item again on doc ready:

$(document).ready(function () {
    $('.mega-menu li > div').css('display', 'block');
});

This will remove the flicker.
I tried every soltion here none worked 100% for me. This does in IE11.

宫墨修音 2024-12-29 12:30:59

在菜单 CSS 的第一行,您必须使用以下行:-

#menu li ul {display: none;}
#menu .sub ul {display: block;}

At the First Line of Menu CSS you have to use following lines:-

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