 |
 |
Trouble with visited state using css image rollovers
|
 |
|
 |
|
Mac Elite
Join Date: May 2002
Status:
Offline
|
|
Hi,
Any help I can get on this would be greatly appreciated. I'm using a CSS image rollover on some links. All the states work except the visited state ... it just goes back to the inital state after clicking the link.
http://www.nomadicmind.com/Postings/index1d.html
Any ideas why?
Thanks.
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Nov 2001
Location: Are Eye
Status:
Offline
|
|
If I had to guess it's because <a href="javascript:toggleID(1);">Sample 1</a> isn't a page and so it can't really be visited.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2002
Status:
Offline
|
|
That was my thought as well, so I placed a link to another page in the href. Nada. When I hit the back button in the browser the link still showed the intial state.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2000
Status:
Offline
|
|
Originally Posted by headbirth
That was my thought as well, so I placed a link to another page in the href. Nada. When I hit the back button in the browser the link still showed the intial state.
It worked for me, if I just changed the URL to say http://www.google.com/ or some other page. Since you're using JavaScript, you might want to opt for a purely JavaScript approach. After the button has been clicked, have JS change the CSS and then set a cookie if you want it to stick.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2002
Status:
Offline
|
|
Thanks for the info Synotic. I was going to fall back on JS as a last resort. Aside from creating separate pages can you think of another way to trick the browser? A CSS solution seems so much cleaner.
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Nov 2001
Location: Are Eye
Status:
Offline
|
|
put an actual address in the url (even if it's just an anchor on the same page), and place the javascript as an onclick event?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2002
Status:
Offline
|
|
Hmmm... No go. I tried this:
<a href="#top" onclick="toggleID(1)">Sample 1</a>
Nothing in Safari and the rollover images are lost in Firefox.
Nice thought though.
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Nov 2001
Location: Are Eye
Status:
Offline
|
|
hmmm... what if you set the href to the image that gets swapped in and return false on the onclick handler so that the browser doesn't actually follow the link?
<a href="image.png" onclick="toggleID(1); return false;">
or some such thing. probably not. But that technique is at least accessible to non-javascript enabled users, if you're concerned about that.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |