Created
April 12, 2010 21:05
-
-
Save sanxac/363997 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This script randomly cycles images with t1 and t2 id tags with a fade effect by jQuery | |
//by Sanja Curgus 2008 | |
$(document).ready(function() | |
{ | |
$("#t1").hide(); | |
$("#t2").hide(); | |
var ThumbsCount = 3; | |
var thumbs = new Array (ThumbsCount); | |
var t = 0; | |
while (t <= ThumbsCount){ | |
thumbs[t] = '{pathToTop}img/thumbs/'+{linkID}+t+'.jpg'; | |
t++; | |
} | |
$.preloadImages(thumbs); | |
var i=Math.floor(Math.random()*ThumbsCount); | |
var j=Math.ceil(Math.random()*ThumbsCount); | |
if (j == i) j++; | |
$(".slowFade").attr({ | |
src: "{pathToTop}img/thumbs/"+{linkID}+i+".jpg", | |
title: {linkID}, | |
alt: {linkID} | |
}); | |
$(".normFade").attr({ | |
src: "{pathToTop}img/thumbs/"+{linkID}+j+".jpg", | |
title: {linkID}, | |
alt: {linkID} | |
}); | |
$(".slowFade").fadeIn("slow"); | |
$(".normFade").fadeIn("normal"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment