How can I fix image rollovers in Safari 3?

  • Thread starter Monique
  • Start date
  • Tags
    Image
In summary, the conversation is about programming image rollovers that work in Safari 3. The code provided by one person works on IE7, Firefox 3, and Safari 3 for Windows, but modifications are needed for it to work in XHTML. Another person suggests using PHP to make the code easier, and offers an alternate code solution for making the "faq" button active on the FAQ page.
  • #1
Monique
Staff Emeritus
Science Advisor
Gold Member
4,219
68
Does anyone have experience with programming image rollovers that work in Safari 3? I programmed a website a while ago and everything worked fine, until Safari got updated to version 3. It seems to be a common problem, many programmers complain of this bug, but I haven't come across a solution.

Any suggestions?
 
Technology news on Phys.org
  • #2
The following code works fine in an HTML 4.01 page on IE7, Firefox 3, and Safari 3 for Windows:
Code:
<IMG src="myimage1.png" onmouseover="this.src='myimage2.png'" onmouseout="this.src='myimage1.png'">
The appropriate modifications allow it to work in XHTML as well. What is the code you're using?
 
  • #3
Thank you, I test-cased it on the Safari 3 for Mac and it works like a charm!

The code I'm using is xhtml with css, java and php. *edit* Wouldn't it be easier to make the code in php?

Right now I have in my navigation page:
<img src="img/navigation_items/faq<? if($current_scriptname=="faq.php") echo "_act";?>.png">

The menu item button "faq" will be displayed as active when someone is on the "faq" page. So if I could put in a mouseover statement in there that also echos "_act", I would be done.
 
Last edited:
  • #4
When the page is on the FAQ, you no longer need the javascript at all, so you could use something like this:
Code:
<img src="img/navigation_items/faq<?if($current_scriptname=="faq.php") {?>_act.png" <?} else {?>.png" onmouseover="this.src='img/navigation_items/faq_act.png'" onmouseout="this.src='img/navigation_items/faq.png'"<?}?> />
 

FAQ: How can I fix image rollovers in Safari 3?

What are image rollovers in Safari 3?

Image rollovers in Safari 3 refer to a CSS technique that allows for an image to change when a user hovers their mouse over it. This effect can be achieved by using the :hover pseudo-class in CSS.

How do I create image rollovers in Safari 3?

To create image rollovers in Safari 3, you will need to use a combination of HTML, CSS, and JavaScript. First, you will need to create two versions of the image - one for the normal state and one for the hover state. Then, you can use CSS to hide the hover state image and use the :hover pseudo-class to display it when the user hovers over the image. You can also use JavaScript to add additional effects or animations to the rollover.

Can I use image rollovers in Safari 3 for navigation menus?

Yes, image rollovers can be used for navigation menus in Safari 3. You can use the :hover pseudo-class on a link element to change the background image or color when the user hovers over it. This is a common technique used for navigation menus on websites.

Are there any limitations to using image rollovers in Safari 3?

Yes, there are some limitations to using image rollovers in Safari 3. One limitation is that they may not work in older versions of the browser or in other browsers such as Internet Explorer. Another limitation is that they may not work on touch devices, as they rely on the user hovering their mouse over the image.

Can I use image rollovers in Safari 3 without using JavaScript?

Yes, it is possible to create image rollovers in Safari 3 without using JavaScript. As mentioned earlier, you can use the :hover pseudo-class in CSS to achieve this effect. However, using JavaScript can provide more flexibility and control over the rollover effect.

Similar threads

Back
Top