Results 1 to 4 of 4

Thread: Test Cache

  1. #1
    Join Date
    Jul 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Test Cache

    I am working on a web gallery script that uses a javascript crossfade after preloading images. The problem I have is the crossfade script is written in such a way as to only allow one image to crossfade at a time. Any subsequent requests to crossfade an image while the first one is still fading are ignored. This is not a problem until the images are cached, in which case they preload all at the same time and only the first image crossfades and the rest stay on the loading image.

    The only solution I can see working is to test the page to see if it is cached and if so skip the crossfades and simply change the image source. Is there any way to do this in javascript?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I wouldn't do that... what you really want to test is whether the crossfade worked or not. If not, just wait a little while (say half a second) and try again. A well-written script will allow you to do this; a badly-written one will have to be modified. Either way, we'd have to see the script to work out how to do it.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jul 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

  4. #4
    Join Date
    Jul 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok, I figured it out. I created a variable "fade" with the value "notDone". And then at the end of the crossfade script i set it to "done" then I put a function on my page that tested the value of fade. If fade != done it used the setTimeout function to pause for half a second or so and try again.

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
  •