Click to See Complete Forum and Search --> : fading an image relative to center...?


syn_apse
11-09-2003, 04:35 PM
im trying to write a function to fade and image's opacity on different layers of the same page according to the pointer's position to the center of that particular image. but i'm fairly new to javascripting and don't know all of the syntax that would be involved. i have the following snippet of code that i found embedded in a different type of image fading script:

if(ie5){
imgs.style.filter="alpha(opacity=0)";
imgs.filters.alpha.opacity = opacity;
}
if(ns6){
imgs.style.MozOpacity = 0 + '%';
imgs.style.MozOpacity = opacity + '%';


i assume that this is the actual syntax needed to change the opacity of the image in question. what i would like to know is how to grab both the image and the mouse position in such a way that the effect can work on different image layers at the same time, probably with different center points.

the goal is to have a single function that works as on onMouseOver, but i don't know how to get the script to grab that particular image's height and width (and therefore the centerpoint).

i know this is alot, but any help would be appreciated..

syn_apse
11-09-2003, 07:46 PM
okay...lemme rephrase this...

to fade an image in to a specific opacity determined by the proximity of the mouse to the center of the image i need to determine two things; the mouse position and the centerpoint of the image in question. the centerpoint of the image can be determined by a simple equation, but i would need to input the height and width.

what is the syntax required to input these values?...

mousePos = document?.WHATGOESHERE? //users mouse position

imgHeight = document?.img?.WHATGOESHERE?
imgWidth = document?.img?.WHATGOESHERE?

can anyone help, or at least point me to a website that can (i've tried most of the big ones)..