I have a webcam, currently uploading images as per motion detection. The latest image is always called Webcam.jpg, the next most recent is Webcam1.jpg, etc. I'd like to show the latest few, and replace each with the latest version of the file every minute or so. I can simply update the src (using a changing URL variable to avoid caching issues), but I'd rather the new file be faded in, but am unsure where to start.
My current code only replaces one image: <img id="main" src="/images/Webcam.jpg" /> <script language="JavaScript" type="text/javascript" src="jquery.js"></script> <script language="JavaScript" type="text/javascript"> function refreshImg() { interval = 60000; // 1 min var tmp = new Date(); tmp = '?nocache=' + tmp.getTime(); $('#main').attr('src','/images/Webcam.jpg'+tmp); setTimeout("refreshImg()", interval); } $(document).ready(function(){ refreshImg(); }); </script> Clearly, this isn't the best code ever, but it is functional, and this isn't for anything more than personal use ATM. Any advice will be much appreciated. -- View this message in context: http://www.nabble.com/fading-image-replace--tf4551015s27240.html#a12987612 Sent from the jQuery General Discussion mailing list archive at Nabble.com.