Welcome to WebmasterWorld Guest from 34.229.24.100

Forum Moderators: open

Message Too Old, No Replies

Script not loading quick enough

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

Junior Member

10+ Year Member Top Contributors Of The Month

joined:July 4, 2007
posts: 193
votes: 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.