Hi,

I case anybody was wanting a way to pre-load the images before the views cycle jquery voodoo kicks in you can put the following into the "Header" field under "Basic Settings" for your view:

<?php
drupal_add_js(
'$(document).ready(function() {
   $(".views-cycle-container").hide();
   vCycleImages = setInterval(function() {
      var bImgLoaded = true;
      var images = $(".views-cycle-container img");

      for (var i = 0; i < images.length; i++) {
         var img = images[i];
         if (img.complete == false)
            bImgLoaded = false;
      }

      if (bImgLoaded) {
         $(".views-cycle-container").show("normal");
         clearInterval(vCycleImages);
      }
   }, 1000);
}); ' , 'inline' );

?>

Make sure you set the input format to PHP. This is a first crack at a preloader and it suits my needs. It would be cool to figure out how to put a little spinning wheel in there.

Enjoy,
Michael

Comments

eabrand’s picture

Status: Active » Needs review

This would be good to put into the documentation.

Crell’s picture

Status: Needs review » Closed (won't fix)

Images are all presented at once anyway, so I don't see the need for a preloader.