开发者

jquery executing menu loading before the page loads

I have an issue with the menu that I have. It's done in jquery and every time I refresh the page I can see all the levels of the menu, and then it seems like jquery starts working, and menu is f开发者_运维知识库ormatted to look nice. I was wondering if there is a way to load that jquery before it appears on the screen.

Thank you.


just set the menu display to none. Then when the page loads use

$(document).ready(function(){
  $("#menu").whatEverPlugin().show();
});


In my experience, the best solution for this type of issue is to hide the html elements using css (display:none) in your stylesheet. jQuery works by overriding those css attributes on mouse events, so the menu should still function correctly even if the items are hidden initially.


When you first start building the menu you could set it to be hidden, then as the last step make it visible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜