简体   繁体   English

jQuery选项卡的内容加载非常慢

[英]Jquery tabs content loading very slow

I have a landing page with 5 tabs using Jquery. 我有一个使用Jquery的5个标签的登录页面。 While the page is loading, ALL the content of the Tabs is showing on the front page untill the page loads completely and content will be placed and separated into the tabs. 在页面加载过程中,选项卡的所有内容都显示在首页上,直到页面完全加载并且内容将被放置并分离到选项卡中。 The current process is very slow. 当前的过程非常缓慢。 Is there an alternative? 还有其他选择吗? Only javascript is accepted where the landing page is hosted. 托管目标网页所在的位置仅接受javascript。

Are you doing this onDocumentLoad or onDocumentReady? 您正在执行onDocumentLoad或onDocumentReady吗?

I would recommend doing this inside an Init() function... 我建议在Init()函数中执行此操作...

$(Init);
function Init(){
   //set up tabs here
}

I would also suggest using CSS to hide all tab pages except the first as default. 我还建议使用CSS隐藏除默认情况下的第一个选项卡之外的所有选项卡页面。

.NonFirstTabPage
{
   display:none;
}

That way you should only see the first tab page when the page first loads, regardless of how long it takes to set-up the JQuery tab pages 这样,无论页面设置多长时间,您都应该只在页面首次加载时看到第一个选项卡页面。

Just remember, as great as Javascript/JQuery is, don't forget that the basics can solves quite a lot of simple needs to. 只要记住,就象Javascript / JQuery一样,不要忘记这些基础可以解决很多简单的需求。

On another note, I abandoned any built-in tabbing functionality from JQuery as I found it to annoying to get it right (especially with styling) - it was fairy simple to create my own simple function to show and hide tab pages as needed. 另一方面,我放弃了JQuery的所有内置制表功能,因为发现它变得烦人(尤其是使用样式)变得烦人-创建我自己的简单函数以根据需要显示和隐藏选项卡页面非常简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM