Results 1 to 3 of 3

Thread: Second image shows first on Left-Right image slideshow Script

  1. #1
    Join Date
    Jan 2013
    Location
    Central Connecticut
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Second image shows first on Left-Right image slideshow Script

    1) Script Title: Left-Right image slideshow Script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ightslide2.htm

    3) Describe problem: This is a Javascript left to right image slide show presentation that I "inherited" on a website written by DD. I was asked by the client to update the slide show with new photos and I have done so.

    When the slide show presents, the second image shows up briefly, then is replaced by the first. Then the slide show proceeds normally. You can see this happening at the following link:

    visualperceptions.com/rh.html

    I don't want to go in and start editing the JavaScript. I would also prever to not have to replace this with another slide show.
    Last edited by jscheuer1; 01-06-2013 at 07:27 PM. Reason: add url on DD

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,954
    Thanks
    43
    Thanked 3,195 Times in 3,157 Posts
    Blog Entries
    12

    Default

    It's because the second image is about half the size in bytes of the first image so is loading faster and because the second image isn't moved out of the way until both images have loaded. We can change that by editing here:

    Code:
    <script language="JavaScript1.2">
    if (ie||dom){
    document.writeln('<div id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden;background-color:'+scrollerbgcolor+'">')
    document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0px;top:0px">')
    document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:1px;top:0px;">')
    document.write(slideimages[0])
    document.writeln('</div>')
    document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:0px">')
    document.write(slideimages[1])
    document.writeln('</div>')
    document.writeln('</div>')
    document.writeln('</div>')
    }
    </script>
    Change that highlighted line to:

    Code:
    document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:'+scrollerwidth+';top:0px">')
    There's a slight chance that the second image might not load until it starts to slide in though. If that happens we can preload it. But I think it will be fine.
    - John
    ________________________

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

  3. #3
    Join Date
    Jan 2013
    Location
    Central Connecticut
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for finding the script link for me. I looked around and could not find it.

    Are we supposed to NOT post links to a website example in this forum? (I participate in others where everyone wants to see ALL the code).

    I am calling this a bug in the script. Anyone who sets up a series of photos for the slide will expect the first image to show to be the first slide.

    I do apologize for the website. I did not build it and have asked if the client can free up enough money to get rid of the tables. Yuck!

    I would also like to externalize the JavaScript. An external file may fit in a browser cache and the website could simply call it, which would make things load a lot faster. That and also minifying it.

    Thanks for the very quick response.

    -Mark

Similar Threads

  1. Left-Right Image Slideshow Script
    By EHardman in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 10-17-2009, 09:33 PM
  2. Left-Right Image Slideshow Script
    By roy in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 01-30-2009, 11:41 AM
  3. Left-Right Image Slideshow Script Help Please
    By allielopez in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 03-05-2007, 03:07 PM
  4. Left-Right Image Slideshow Script
    By jiam in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 03-17-2006, 08:24 AM
  5. Need Help with Left-Right Image Slideshow Script
    By rrkdancer in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 09-26-2005, 02:22 PM

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
  •