Search code examples
jquery-slider

Slider breaks before loading


Hi I am running WordPress latest version with a custom coded jQuery featured post slider in all pages. My problem is that the slides appears broken for 2 seconds when the page is loading, after the page is fully loaded it runs fine. If you wish you can have a look http://crunchmarketing.com.au/. Please help me out.


Solution

  • if you're using this (or similar) to execute the code:

    $(function() { 
      $( "#slider" ).slider(); 
    });
    

    This is the same as:

    $(document).ready(function () { 
      $("#slider").slider();
    })
    

    meaning the code wont execute until the page has loaded. It's the same with all jquery's functions, they are only loaded when the document has loaded completely.