Rene Zammit
Rene Zammit

Reputation: 1151

Jquery tabs content loading very slow

I have a landing page with 5 tabs using Jquery. 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.

Upvotes: 0

Views: 1802

Answers (1)

musefan
musefan

Reputation: 48415

Are you doing this onDocumentLoad or onDocumentReady?

I would recommend doing this inside an Init() function...

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

I would also suggest using CSS to hide all tab pages except the first as default.

.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.

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.

Upvotes: 1

Related Questions