SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member pangono's Avatar
    Join Date
    Oct 2007
    Location
    Mauritius
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow Background Image Slideshow and Fade

    Hope you can help.

    I trying to get the image in the masthead to cycle through a small number of images. The image is the background-image of the div 'masthead'.

    It works in Firefox but I'm getting an error in IE. The error is 'invalid argument' and refers to the j increment. I can't see the prob.

    Also the slideshow is a bit abrupt and I need to make the images fade into each other. My old method and examples I've seen on the web don't seem to work. Does anyone know how to do it?

    Code is:
    Code:
    var speed = 3000;		// Slideshow speed
    var pics = new Array();
    var path = 'http://www.intergise.com/dev/platinum/images/';
    pics[0] = path + 'home_contemp.jpg';
    pics[1] = path + 'home_trad.jpg';
    pics[2] = path + 'home_modern.jpg';
    var t;
    var j = 0;
    var totalPics = pics.length;
    var preLoad = new Array();
    
    for (i = 0; i < totalPics; i++)
    {
    	preLoad[i] = new Image();
    	preLoad[i].src = pics[i];
    }
    
    function runSlideShow()
    {
    	document.getElementById('masthead').style.backgroundImage = 'url(' + pics[j] + ');';
    	j = j + 1;
    
    	if (j > (totalPics - 1))
    	{
    	    j = 0;
    	}
    
    	t = setTimeout('runSlideShow()', speed);
    }
    XHTML is:
    HTML Code:
    <body onload='runSlideShow()'>
    	<div id='container'>
    		<div id='masthead'>
    Thanks in advance

  2. #2
    SitePoint Member pangono's Avatar
    Join Date
    Oct 2007
    Location
    Mauritius
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bueller? bueller? bueller?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •