Results 1 to 3 of 3

Thread: start delay for Ultimate Fade-in slideshow

  1. #1
    Join Date
    Jun 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default start delay for Ultimate Fade-in slideshow

    Ultimate Fade-in slideshow

    http://www.dynamicdrive.com/dynamici...nslideshow.htm

    I want to feature four instances of slideshows on the page which works fine.
    However, I would like to put a different start delay into each so that the images will change individually not all together but with the same delay between changes.

    I thought I was on the right track by putting an extra parameter in the call
    Code:
    for startdelay:
    new fadeshow(fadeimages3, 319, 229, 0, 4000, 1, "R", 4000);
    then:
    Code:
    function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder, startdelay){
    
    this.startdelay=startdelay
    and further down:

    Code:
    if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
    setTimeout("document.write('<div id=\"master'+this.slideshowid+'\" style=\"position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;\"><div id=\"'+this.canvasbase+'_0\" style=\"position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'\"><\/div><div id=\"'+this.canvasbase+'_1\" style=\"position:absolute;width:'+this.fadewidth+'px;height:'+this.fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'\"><\/div><\/div>')", this.startdelay)
    else
    setTimeout("document.write('<div><img name=\"defaultslide'+this.slideshowid+'\" src=\"'+this.postimages[0].src+'\"><\/div>')", this.startdelay)
    This caused an error with fadewidth and fadeheight not being defined, so I added:
    Code:
    this.fadewidth=fadewidth
    this.fadeheight=fadeheight
    at the start and commented out:
    //var fadewidth=fadewidth+this.imageborder*2
    //var fadeheight=fadeheight+this.imageborder*2, 
    adding "this." to the document.write
    Now I'm getting error: picobj is null

    Any ideas?

    cheers
    Last edited by Snookerman; 06-21-2009 at 02:21 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,922
    Thanks
    43
    Thanked 3,187 Times in 3,151 Posts
    Blog Entries
    12

    Default

    You should almost never set a timeout on document write. If it were to be otherwise successful (no error like you are getting and no other errors), it would overwrite all of the page that had been parsed to that point in time by the browser - generally not desirable.

    Other than that issue, it looks like you are basically on the right track. The only timeout you need is for the startit function, so after you did:

    Code:
    function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder, startdelay){
    You should have just gone to these lines:

    Code:
    if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
    this.startit()
    and changed them to:

    Code:
    if (iebrowser&&dom||dom) { //if IE5+ or modern browsers such as Firefox
    var cacheObj = this;
    setTimeout(function(){cacheObj.startit();}, startdelay || 0);
    }
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for that J. Worked a treat :-)

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
  •