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 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer Setting cells' background-image: Too slow

    I have a list of all the table cells that I want to change the style of in an array. Right now, I am going through the array in a for loop and changing the className of each cell. the new class sets a background-image on the corresponding cell which makes it really slow in IE. For some reason, that process is pretty fast in Mozilla.

    Do you guys have any suggestions on how to make it faster?

    I have tried using setTimeout to set background-image on each cell simultaneously but it's very buggy and still slow.
    I have also tried only changing the background-image of cells that in the user's view but I can't afford to put a bunch of function calls to get the right position of each cell in that huge loop.

    Thanks in advance.

  • #2
    Regular Coder medigerati's Avatar
    Join Date
    Jul 2005
    Location
    San Antonio, Tx
    Posts
    163
    Thanks
    0
    Thanked 7 Times in 7 Posts
    maybe try setInterval...
    If you need a little more help, I'm available as a Website designer in San Antonio
    ----------
    If I've helped, please check out my friend's nature photography and let me know if you like anything.

  • #3
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Same thing...

  • #4
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Anyone? There must be some kind of solution...

  • #5
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Can you post up your code please.

    Then we can try and optimise from there.

    Cheers

    m_n
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #6
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I goes something like this:

    PHP Code:
    function updateAllCells(allcells)
    {
        for(var 
    i=0i<allcells.lengthi++)
            
    setTimeout("this.insideUpdate(" ")"1);
        
        
    this.insideUpdate = function updateMyCell(i) { 
        
    allcells[i].className "new_selection";
        }
    }

    function 
    updatefunc
    {
        var 
    allSelectedCells document.getElementByName(MYNAME);
        
    updateAllCells(allSelectedCells)


    I call updatefunc, but this process of selection is still slow.

  • #7
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PS: the above doesn't completely work either. If I select a group of cells and then some other group of cells, it won't deselect the first group. Some kind variable change issue going on...

  • #8
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    IE has a background-image bug. It always requests the image from the server and does not get it from cache if the setting is set to "Every visit to page". There's even an article that discusses how to minimize the flickering background image.

    http://www.fivesevensix.com/studies/ie6flicker/
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #9
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, glenngv. Even if I cache my page (which most users will do anyway) the selection is still pretty slow. It's not as fast as when I change the background-color instead of background-image.
    I've tried reducing the image size (transparent .gif) to 3x3 px but that doesn't really make a difference either.


  •  

    Posting Permissions

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