SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why doesnt this jQuery rollover work in Chrome?

    Hello there,

    Please look at our website: Brukte Truser Selges (Not safe for work!)

    On the right side, under the portrait of the two girls, you will see a list of four links next to some dates. onMouseOver, the photograph of the girls should change. This works fine in IE, Firefox, Safari and Opera.

    In Chrome, however, it seems (using Chrome Developer Tools) that Chrome load the images each time, instead of preloading, and displaying the cached image each time i onMouseOver.

    What are your views?

    Thank you for your time.

  2. #2
    SitePoint Enthusiast TriLLi's Avatar
    Join Date
    Feb 2010
    Location
    BiH, Bugojno
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have check it, you are changing image location each time,

    what you need to do is hide displayed image and show another one
    for example
    Code HTML4Strict:
    <div id='img_holder'>
    <img src="..." id="one" />
    <img src="..." id="two" style="display: none"/>
    <img src="..." id="four" style="display: none" />
    <img src="..." id="five" style="display: none" />
    </div>
    <div id="link_holder">
    <a href="#" onmouseover="change_image('one');" >One</a>
    <a href="#" onmouseover="change_image('two');" >Two</a>
    <a href="#" onmouseover="change_image('three');" >Three</a>
    <a href="#" onmouseover="change_image('four');" >Four</a>
    </div>

    and javascript
    Code JavaScript:
    function change_image(img)
    {
      var h = document.getElementById('img_holder');
      var imgs = h.getElementByTagName('img');
      for(var i = 0; i < imgs.length; i++)
      {
        imgs[i].style.display = 'none';
      }
      document.getElementById(img).style.display = '';
    }

    I hope this can help you.
    http://www.wiseblog.info
    Programmers don't die, they just GO SUB without return.


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
  •