Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    rollover menus don't preload

    I have a bunch of menu buttons that rollover properly and javascript preloading that I THOUGHT used to work but isn't now. It's flickering and reloading the images each time the mouse is moved over top and off, even on the same button. I thought they worked perfectly in the past, but with no changes they're not working today.
    Here's the simplified code
    Code:
    <style  type="text/css">
    #imagetabred a:hover, #imagetabred a.current{  /*change background when over red tabs*/
        background-image:url(http://yaddayadda/BMenuTabRedOver.jpg);
        color: #330000;
    }
    </style>
    
    
    <SCRIPT language="JavaScript">
        <!--
        if (document.images)
        {
          preload_image_object = new Image();
          // set image url
          image_url = new Array();
          image_url[0] = "http://yaddayadda/BMenuTabRed.jpg";
          image_url[1] = "http://yaddayadda/BMenuTabRedOver.jpg";
     
            // creating image objects using above URLs
            var preloadedImages = new Array(); 
            var i
            for(i=0; i<=image_url.length; i++){ 
             preloadedImages[i]  = new Image(); 
             preloadedImages[i].src = image_url[i]; 
            } 
        }
        //-->
    </SCRIPT>
    <div > 
    <span id="imagetabred"><a href="http://yaddayadda/link.htm" target="_blank">BUTTON</a> </span> 
    </div>
    I know about putting the 2 images together in 1 file can be an alternate to this, but I have a lot of images and redoing everything isn't possible at this stage. If anyone sees a flaw with the above code, please point it out.
    thanks

  • #2
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There is nothing wrong with your code that I can see. Then again it is 3:30am. I do know that a lot of browsers handle this situation different. If you where using the actual javascript image objects to display the images then it would not reload. But if you are using CSS in IE the images to refresh as it makes a hit back to the server without checking to see if it is in the cache. I do not know why this happens I just know that in certain circumstances it does happen.
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.

  • #3
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh oh! how do i use javascript to display them? I was wondering about that but I'm new to javascript. please please reply

    thanks

  • #4
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    can i get a bump?


  •  

    Posting Permissions

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