Team:Alberta/application.js

From 2011.igem.org

(Difference between revisions)
m
m
Line 13: Line 13:
-
 
+
function preload(images) {
-
     if (document.images)
+
     if (document.images) {
-
    {
+
        var i = 0;
-
      preload_image_object = new Image();
+
        var imageArray = new Array();
-
      // set image url
+
        imageArray = images.split(',');
-
      image_url = new Array();
+
        var imageObj = new Image();
-
      image_url[0] = "https://static.igem.org/mediawiki/2011/1/10/TeamAlbertaButton1.JPG";
+
        for(i=0; i<=imageArray.length-1; i++) {
-
      image_url[1] = "https://static.igem.org/mediawiki/2011/5/50/TeamAlbertaButton1-Hover-v1.JPG";
+
            //document.write('<img src="' + imageArray[i] + '" />');// Write to page (uncomment to check images)
-
      image_url[2] = "https://static.igem.org/mediawiki/2011/9/9d/TeamAlberta-Button2.JPG";
+
            imageObj.src=images[i];
-
      image_url[3] = "https://static.igem.org/mediawiki/2011/3/3d/TeamAlberta-Button2-Hover-v1.JPG";
+
        }
-
      image_url[4] = "https://static.igem.org/mediawiki/2011/8/81/Notebook.JPG";
+
-
      image_url[5] = "https://static.igem.org/mediawiki/2011/b/bf/TeamAlberta-Button3-Hover-v1.JPG";
+
-
 
+
-
      var i = 0;
+
-
      for(i=0; i<=5; i++)  
+
-
        preload_image_object.src = image_url[i];
+
     }
     }
 +
}

Revision as of 03:57, 12 July 2011

// This file for javascript that we want to include on all pages

$(document).ready(function(){

 // show the drop down list on hover
 $('li.headlink').hover(
   /*function() { $('ul', this).show(); },
   function() { $('ul', this).hide(); }*/
   function() { $('ul', this).css('display', 'table') },
   function() { $('ul', this).css('display', 'none') }
 );

});


function preload(images) {

   if (document.images) {
       var i = 0;
       var imageArray = new Array();
       imageArray = images.split(',');
       var imageObj = new Image();
       for(i=0; i<=imageArray.length-1; i++) {
           //document.write('<img src="' + imageArray[i] + '" />');// Write to page (uncomment to check images)
           imageObj.src=images[i];
       }
   }

}