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!

You can do rollovers with just css, which might be a better solution. An example is here: http://ago.tanfa.co.uk/css/examples/rollover-images-no-preload.html (or just google for 'css rollover', and you'll find tons of variations)

Jonathan

Reply via email to