Thank you Chris.

I have adapted the script you provided for my use, changing the way of
getting elements and adding an event/effect on the first array, and I
went from a 133 lines script to 25 lines ! (and from 2.48Ko to
647o)...

Much more elegant and lighter.

Happy new year !

On 27 déc, 12:10, cbolson <[email protected]> wrote:
> Hi,
> You need to use the array "index" to relate the links with the images.
> Here is a simple demo for you (using spans for the images but you
> should get the gist ;) )http://mooshell.net/TVybm/
>
> Chris
>
> On 27 dic, 11:38, Daniel Lohse <[email protected]> wrote:
>
> > Please, put your code in a MooShell and then we can take a look.
>
> > Here:http://mooshell.net
> > Or here:http://mootools.net/shell
>
> > Cheers, Daniel
>
> > On Dec 27, 2009, at 10:20 AM, Simon Vart wrote:
>
> > > Hello,
>
> > > I'm starting to use Mootools, which is pretty useful.
>
> > > I've created a little code very simple, for changing opacity of a
> > > image when mouse flies over the image or when it flies over a link
> > > nearby (but not in the same layer).
>
> > > I have 6 images and 6 links.
>
> > > I've created 6 times the same code and declare 12 variables a the
> > > beginning of the script.
>
> > > It's working, but I'm sure there is a much more elegant way to do it,
> > > by :
>
> > > - Creating a array of the 6 link (linkArray = $$('div a');)
> > > - Creating a array of the 6 images (imgArray = $$('div img');
>
> > > Then i don't know how to associate the two array, and make that when
> > > the mouse is flying the link #5, it will trigger the script for the
> > > image #5
>
> > > I would appreciate help from more power users if you have some
> > > thinking about it.
>
> > > Thank you and happy new year.

Reply via email to