Simple rollovers should be done with CSS and using a sprite image rather then two seperate images.

Geir wrote:
Hi!
..rather new to javascript

I'm making a rollover-script for my site.
It works fine for one image, but not for many.
How can I modify it to supprt any number of images?

        var sti = $('.ro').attr('src');
        var nySti = sti.replace('.png', '_ov.png')
        $('.ro').hover(function()
                {$(this).attr('src', nySti)},
                function()
                {$(this).attr('src', sti)}
                );

for image.png  class="ro"
hoverstate is image_ov.png

Thanks!

Reply via email to