HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

.html files/rollover affect

12-01-2003, 05:23 AM#1
UltimateJim
im not sure where this goes so i guess i'll post it here, how do you get the rollover effect like the buttons for home/forum etc, in adobe imagready, it save it as "on" and "off" just like ther are 2 buttons for http://www.wc3campaigns.com/forums/i...ut_tuts_on.gif and http://www.wc3campaigns.com/forums/i...t_tuts_off.gif
()

does this require php programming? because if i save the file as a .html it works like i want it too, but i can host it anywhere emote_sweat atached is the button in .gif and .html, anyone know anyhitng about his?
12-01-2003, 06:13 AM#2
JollyOven
You seem to be misunderstanding what php is. It is a serverside scripting language, which generates a page, and sends it to the browser. By the time you see a page, php is done. Thus, any clientside events, such as an image changing when you mouseover it, are completly unrelated to how the page is generated.

There are several ways to have image rollover effects. The first, bad way, is to use fugly JS. This is the method taken by this site.

The far better approach is to do the rollovers in CSS. Once again, this can be done in several ways. The first is to have only a small area of the image change from one color to another. To do this, leave all of the areas which will change in the image transparent, and apply the following CSS to the link around the image:
a.link {
background-color : red;
}
a.link:hover {
background-color : blue;
}
(Or whatever colors you want)

If you want the actual picture to change, it gets slightly harder. The simplest way is as follows:
<a href="page.html" id="menuitem1"></a>
<style>
#menuitem1 {
background-image : url(off.jpg);
display : block;
height : 200px;
width : 400px;
}
#menuitem1:hover {
background-image : url(on.jpg);
}
</style>

However, this will not preload the rollover images, which is a bit of a problem. An easy solution to this is as follows:

#menuitem1 {
background-image : url(off.jpg);
display : block;
height : 200px;
width : 400px;
}
#menuitem1:hover {
background-image : none;
}
#menuitem1back {
background-image : url(on.jpg);
}

<div id="menuitem1back"><a href="page.html" id="menuitem1"></a></div>

There are other, better ways, but they involve advanced CSS.
12-01-2003, 03:34 PM#3
NueRoN-X
i believe theres an easier way to do it than the way Jolly Oven said it.
It's really quite simple if you know the code, and its not php at all.
12-02-2003, 01:10 AM#4
JollyOven
Easier than four lines of CSS?
12-02-2003, 01:31 AM#5
UltimateJim
... though what you typed looks very nice and....... complicated, i dont even know what css is emote_sweat i used adobe image ready and it worked out like i wanted it too but i dont know how to post it over the net :bgrun:
12-02-2003, 08:19 PM#6
Kerry
http://www.vortex-webdesign.com/help/rollovers.htm << Or with JavaScript.
12-02-2003, 11:08 PM#7
Tiki
omg i hate javascript... but here you go, in javascript...

heres the easiest html for hover... rollover... wutever...


heres the style script...
Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin

image1 = new Image();
image1.src = "OnBUTTON.gif";

image2 = new Image();
image2.src = "OnBUTTON.gif";

image3 = new Image();
image3.src = "OnBUTTON.gif";

image4 = new Image();
image4.src = "OnBUTTON.gif";

// End -->
</script>

(Note: If you want more, just change the numbers , like image5, image6...)

and heres the code for the actual button...
Code:
<a href="LOCATION"><img name="image1" onmouseover="image1.src='ON BUTTON.gif';"
onmouseout="image1.src='OFF BUTTON.gif';" border="0" src="OFF BUTTON.gif" width="-" height="-"></a>

(Note: same as before, for the different buttons change the number like image2, image3
12-03-2003, 01:33 AM#8
UltimateJim
... i have absolutley no idea what ur talking about, so i would put [img]Your complicated stuff here but with the urls of my image[/img
12-03-2003, 06:37 PM#9
Earth Fury
u COULD do all that complex code (complexfor a noob) or u could 'aquire' dreamweaver and use the rolover image addin. (i myself do it all in textpad :P)
12-03-2003, 07:15 PM#10
ChoboMapper
if your trying to do it for your sig here you can't, sigs don't allow HTML, only VBcode.

(only assuming this becasue he brought up [img])
12-03-2003, 11:21 PM#11
Tiki
Quote:
Originally posted by ChoboMapper
if your trying to do it for your sig here you can't, sigs don't allow HTML, only VBcode.

(only assuming this becasue he brought up [img])


if thats true, just make it animated...
12-04-2003, 12:49 PM#12
Earth Fury
or see if the old javascript in vb sig's bug has been fixed. (i wont actualy tel lyou how to do this cause if its not then u can use anoying javascritps in ur sig)
12-04-2003, 10:43 PM#13
Whitehorn
Something I made a while back:

http://www.web-zealots.co.uk/db/gothic.html

The code can be done automatically with a decent package, such as Macromedia Dreamweaver, but otherwise the code you need to insert into the image tag goes along the lines of:

onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('name','','image2.gif',1)"><img name="name" border="0" src="image.gif"


Take a look at the source, or check out that URL someone posted, for tutorials.