[jQuery] Re: Image rollover using jQuery
Thank you. This is exactly what I want! On Dec 1, 12:46 pm, howa <[EMAIL PROTECTED]> wrote: > http://code.google.com/p/jquery-swapimage/ Ray
[jQuery] Re: Image rollover using jQuery
That's a terrible way of doing a swap image. That's adding a load of crap into the actual HTML, most likely creating invalid xHTML and if that's the author's solution then you might as well just use Dreamweaver as it will do that for you. A better solution is to use seasoup's method, or one similar to it: $('img').hover(function() { $(this).attr('src',path + '' + $('this).attr('id') + '_over.gif'; }, function() { $(this).attr('src',path + '' + $('this).attr('id') + '_off.gif'; }); -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of howa Sent: Sunday, November 30, 2008 10:46 PM To: jQuery (English) Subject: [jQuery] Re: Image rollover using jQuery Maybe this: http://code.google.com/p/jquery-swapimage/ On Nov 30, 5:14 pm, Ray M <[EMAIL PROTECTED]> wrote: > Hello, > > Are there any existing jQuery plugin which can provide similar image > rollover functions such as the one provided by Dreamweaver? > > Thanks. > > Ray
[jQuery] Re: Image rollover using jQuery
plugin? How about the native .hover? $('img').hover(function() { $(this).attr('src',path + '' + $('this).attr('id') + '_over.gif'; }, function() { $(this).attr('src',path + '' + $('this).attr('id') + '_off.gif'; }); That will make every image on the page a rollover, changing the src of the image to the id + "_over.gif" or "_off.gif" of the image in whatever directory you have defined path to be. Instead of using the ID you could look at the src of the image and add '_over just in front of the .gif and take it out for the other hover. However you want to do it. Then change the selector to be whatever group of images you want to have rollovers. Maybe $('img.rollover') which would be all images with the class rollover. On Nov 30, 1:14 am, Ray M <[EMAIL PROTECTED]> wrote: > Hello, > > Are there any existing jQuery plugin which can provide similar image > rollover functions such as the one provided by Dreamweaver? > > Thanks. > > Ray
[jQuery] Re: Image rollover using jQuery
Maybe this: http://code.google.com/p/jquery-swapimage/ On Nov 30, 5:14 pm, Ray M <[EMAIL PROTECTED]> wrote: > Hello, > > Are there any existing jQuery plugin which can provide similar image > rollover functions such as the one provided by Dreamweaver? > > Thanks. > > Ray
[jQuery] Re: Image rollover using jQuery
On Nov 30, 2008, at 4:14 AM, Ray M wrote: Hello, Are there any existing jQuery plugin which can provide similar image rollover functions such as the one provided by Dreamweaver? Thanks. Ray Hi Ray, If you're referring to the dreaded MM_swapImage(), I think most people these days just use image sprites and change the background position on hover using pure CSS. If you want some sort of animated hover effect, one option is described here: http://www.snook.ca/archives/javascript/jquery-bg-image-animations/ --Karl Karl Swedberg www.englishrules.com www.learningjquery.com