homepage Welcome to WebmasterWorld Guest from 107.22.37.143
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Script not loading quick enough
greencode




msg:4568235
 11:03 am on Apr 26, 2013 (gmt 0)

I have a custom built Wordpress site where I have the following custom script that loads after jQuery

$(document).ready(function() {
$('li:first-child').addClass('first');
$('li:last-child').addClass('last');
$('p:last-child').addClass('last');
$(".p-list li:nth-child(odd)").addClass('odd');
$(".p-list.cat li:nth-child(6n+1),li:nth-child(6n+2),li:nth-child(6n+3)").addClass('oddrow');
$('.slider').css('display', 'block');
});

$(document).ready(function() {
$(".p-list .details").dotdotdot({
});
$(".p-list-m .details").dotdotdot({
after: ".more"
});
});

$(function(){
$('ul.sub-menu').addClass (function(idx) {
return "item-" + idx;
});
});

The problem is when the page loads I get a flash of the styling before the CSS classes have been added and so it moves the design slightly.

Any ideas or help with this would be really appreciated as it's driving me nuts!

Thanks in advance.

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved