homepage Welcome to WebmasterWorld Guest from 23.20.61.85
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

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

5+ Year Member



 
Msg#: 4568233 posted 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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved