Forums
This topic is locked
Rollovers don't work in Safari
Posted 05 Feb 2004 21:10:15
1
has voted
05 Feb 2004 21:10:15 Tim Marquardt posted:
I could really use your advice. My site uses many disjointed roll-overs (IE: If I move my mouse over here, then something happens over there). Unfortunately they don't work in Safari like they do in IE and Navigator. I was hoping it was merely a Safari bug that would soon get fixed, but now that 1.2 is out and it still doesn't work, I'm thinking I need to recode my site.
But how?? The way I did it (using the behaviors found in Dreamweaver that hide/show layers) is the only way I know how.
Do you have ideas?? A good example of a page can be found at www.plum.tv/people.html
Thank you in advance for taking the time to read this and/or respond.
Replies
Replied 06 Feb 2004 08:53:42
06 Feb 2004 08:53:42 Dave Clarke replied:
There is no need to use layers for disjointed rollovers.
Insert the image that you want to alter on rollover, then select the link that triggers the rollover, go to Behaviours>Swap Image, in the top section of the dialogue box highlight the name of the image you inserted then in the bottom section set the source to the image you want to appear when the link is rolled over, tick the two check boxes (preload & restore), click on OK and away you go.
I hope this is clear enough, if not just yell!
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Insert the image that you want to alter on rollover, then select the link that triggers the rollover, go to Behaviours>Swap Image, in the top section of the dialogue box highlight the name of the image you inserted then in the bottom section set the source to the image you want to appear when the link is rolled over, tick the two check boxes (preload & restore), click on OK and away you go.
I hope this is clear enough, if not just yell!
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 06 Feb 2004 18:51:59
06 Feb 2004 18:51:59 Tim Marquardt replied:
Thank you very much Dave for taking the time to respond. Your suggestion surely is a good one and may be the way I code disjointed rollovers in the future.
But late yesterday, I just happened to stumble across another solution that miraculously worked, without having to recode each rollover. I should tell you about it, even though I don't understand it.
While surfing the web for a solution, I came across some tutorials that explain exactly what you were talking about with Swap Image commands. So I decided to give it a try. While working on my first page, I previewed in Safari, and noticed something very strange. Some disjointed rollovers that I hadn't yet recoded suddenly worked!!
I made it my mission to find out why. And though I don't understand it, I found that merely swapping some code at the top of each page allowed my "Show/Hide Layers" commands to suddenly work in Safari.
OLD CODE:
function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible'<img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>v='hide')?'hidden':v; }
obj.visibility=v; }
}
Replied 06 Feb 2004 19:01:29
06 Feb 2004 19:01:29 Tim Marquardt replied:
... continued ...
Notice that the version numbers went from 3.0 for each, to 4.01 and 6.0 respectively. Again, I don't know what taht means, but it did.
By the way, I noticed a big benefit for doing "Show/Hide Layers" instead of "Swap Image." You can do text. With "Show/Hide Layers" you don't have to turn your text into images which is saves you a lot of time, is more easily editable, loads faster, and is indexable by google and other search engines.
Thank you, thank you, thank you sincerely for taking the time to respond to my needs. You gave me a great solution that would have worked if I hadn't already stubbed my toe on this solution.
Replied 06 Feb 2004 19:04:10
06 Feb 2004 19:04:10 Tim Marquardt replied:
Oops, I noticed that the system cut off the NEW CODE.
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible'<img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>v=='hide')?'hidden':v; }
obj.visibility=v; }
}
Replied 07 Feb 2004 09:02:01
07 Feb 2004 09:02:01 Dave Clarke replied:
Glad I could help (sort of), all that code you posted makes no sense to me either but hey, if it works who cares?
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome