View Full Version : Re: Rollovers: back button shows referring link stuck in over position


Keith Naidl
08-13-2003, 05:50 PM
DI in TX wrote:
> Richard Grieve Mac MVP <richard.grieve[at]NOvirginSPAM.net> wrote:
>
>>"DI in TX" <puzzolente[at]ev1.net> wrote:
>>
>>
>>>My site contains numerous image links with mouseover/rollover effects.
>>>They all work fine within their page. BUT, when I click the link to go
>>>to a new page, then click the browser back button to return to the
>>>original page, the rollover is still stuck in the over or on position.
>>>Moving the mouse over and off the affected link returns things to
>>>normal.
>>>
>>>This happens on MSIE 5.1.6 on OS 9.2.2, but not on Netscape 4.75.
>>>JavaScript rollovers were created in Adobe ImageReady 7. While not an
>>>everyday problem, it of course looks incredibly unprofessional. TIA
>>>for any help!
>>>
>>>Doug
>>
>>FWIW, my site does exactly the same in OS X IE and Safari. I don't know if
>>there is a workaround for this short of forcing each page to expire so that
>>it needs to be reloaded when clicking Back. In fact, even this may not work
>>properly, and it's certainly a pain to implement.
>>
>>Perhaps someone else can supply a definitive answer.
>>
>>Ricky
>
>
> No definitive answer, I'm afraid, but an update:
>
> Tried adding an onBlur, onClick or onMouseUp to force the referring
> link back to the "off" state. This does eliminate the problem when you
> use the browser back button (and a similar problem where some
> Netscapes left the link "on" when it opened a new window).
>
> Only problem is that MSIE now gives you a definite moment of ugliness
> when the link you are clicking "shuts off" before the page has gone
> away. It's particularly bad when you have a sort of double mouseover
> effect--say in a nav bar where default state is to highlight the page
> name you are currently on, but turn that off and switch highlighting
> to other page links as you roll over them. In that case you get *both*
> in the "on" position as you leave the page (at least on a 56K). Guess
> you could do the nav bar in frames, but no thanks.
>
> I find the workaround to be uglier than the original bug, so guess
> this just has to be written off as a reason to prefer Netscape for
> sites where design is important.
>
> Doug


Hello,

I too have noticed this problem of onstate images "sticking" when the
back button is used, and I don't like it on my webpage either.
(www.raffel.com)

I would like to try your workaround that you mentioned,just to see what
it looks like, even though you feel that the workaround is worse than
the original bug.

I'd like to know the code in detail that you used--you said you added
"an onBlur, onClick or onMouseUp to force the referring
link back to the "off" state." Do you mean any of these 3 will work?

Could you tell me the complete line(s) of code--that is--what code needs
to be put before and/or after the onBlur/onClick/onMouseUP?

Also of course if there is anyone else out there who has any other
insight into this problem, please feel free to reply.

Thanks in advance,

Keith Naidl

DI in TX
08-15-2003, 04:24 AM
Keith,
I don't have the exact code any more, but I remember it being very
simple. Basically, the state you set up in your onMouseOut line should
be cut and pasted as the state for the onClick/MouseUp/Blur, because
logically you want it to return to that original "off" state when
someone clicks to leave the page.

Using an example from your site it might go something like this:

<a href="index.html" onFocus="if(this.blur)this.blur()"
onMouseOver="changeImages('index_top004',
'images/index_top-over.gif'); return true;"
onMouseOut="changeImages('index_top004',
'images/index_top-04.gif'); return true;"
onMouseUp="changeImages('index_top004', 'images/index_top-04.gif');
return true;">

I don't recall a difference between onClick vs. Up vs. Blur, but you
can experiment for yourself to see if there is on your site.

HTH,
Doug


> I'd like to know the code in detail that you used--you said you added
> "an onBlur, onClick or onMouseUp to force the referring
> link back to the "off" state." Do you mean any of these 3 will work?
>
> Could you tell me the complete line(s) of code--that is--what code needs
> to be put before and/or after the onBlur/onClick/onMouseUP?