- Create Account

JS Rollover; png-image sticks after mouse-out.

Forums > IEPNGFix > JS Rollover; png-image sticks after mouse-out.
Author
Message

1) Robustus Group: Members
Posts: 6 Joined: 19 Feb 2007 Location: North Carolina IP: 207.144.--.--
For various reasons, I'm using Javascript rollovers to change css background-image properties. Upon rollover, I change the background image on an <li> element to a png (the htc file is applied to this element). When I mouse-out of the element, my javascript function changes the background-image to "none" - but the png doesn't go away.

Note  that the transparency functionality is working fine.

The rollover works fine in FF, so I know I don't have an error in my JS.

Should this work? Is swapping the css background-image property via Javascript supported by iepngfix.htc (I've tried both RC4 and RC5)?

2) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 203.109.--.--
Have you tried the very latest RC5? I made some fixes regarding this recently at least for classname changing rollovers...

- Angus.

3) Robustus Group: Members
Posts: 6 Joined: 19 Feb 2007 Location: North Carolina IP: 74.236.--.--
I downloaded RC5 today (March 1st, '08).

My  JS isn't using classname changes; I get the element by id, and then do elem.style.backgroundImage = "none"; upon mouse-out.

I just switched over my rollovers to use whatever:hover in order to get around this, and indeed, it does all work now. The only thing is that now there's that split second before the iepngfix filter kicks in where I see a non-transparent version of the image. That wasn't there before I added csshover.htc in conjunction with iepngfix, but it's no big deal.

Again, thanks for your help, and your excellent scripts.

4) monstordh Group: Guests
IP: 69.153.--.--
i'm having the same issue as Robustus. This is a wonderful script. just wish the rollover issue could be resolved.

5) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
Try the whatever:hover fix with your page then if there are bugs with your layout? I do know that JS image swapping works as there is an image rollover in the example script demonstration.

- Angus.

6) monstordh Group: Guests
IP: 69.153.--.--
Thanks, Angus. I'll try that. But in the meantime, would you mind looking at my code to see if I've done something wrong?

http://www.auctiontheatre.com/midwest_energy/test/index.php

7) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
Ah! Be very careful with *getting* the SRC attribute of the image. Remember the script changes it to blank.gif so your current approach will break there. Try:

<img src="AAA" onmouseover="this.src = 'BBB';" onmouseout="this.src = 'AAA';">

I know you have to type the SRC twice but trust me it's simplest ;).

Good  luck - Angus.

8) Jenna Group: Guests
IP: 207.229.--.--
Hmmm I'm having the sticking rollover effect as well. I have DW made rollover buttons but when the iepngfix.htc is working the rollover sticks. I've tried disabling it and my rollovers start working again.

Any ideas?

9) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
Same problem. Just don't use the DW rollover code, use the code I posted above instead.

- Angus.

Post a Reply:

You are not logged in, and will be posting anonymously as a guest. If you want to post using an account, please login at the top of this page.