Skip to main content

Bug Tracker

Side navigation

#4027 closed bug (invalid)

Opened January 29, 2009 07:26PM UTC

Closed February 01, 2009 02:54AM UTC

Animate src bug on Safari and Chrome

Reported by: EricGagnon Owned by:
Priority: minor Milestone: 1.3.2
Component: effects Version: 1.3.1
Keywords: Cc:
Blocked by: Blocking:
Description

First of all, a big thanks to everyone working on jQuery for making this library a real masterpiece. I really enjoy your work!

For the bug: I was trying to make a slideshow by making a picture fadeOut, change src, and then re-appear. So I used animation "stacking":

$('#avant_img').fadeOut();

$('#avant_img').animate(

{

src: 'images/realisations/'+(realisation++)+'b.jpg'

}, 0);

$('#avant_img').load(function(){$('#avant_img').fadeIn();});

It works on IE6, IE7, FF3, Opera but doesn't work on Safari and Chrome. The 'src' attribute is just never changed.

Btw, I found a way to solve this bug, but it is not quite elegant:

$('#avant_img').animate(

{

src: 'images/realisations/'+(realisation++)+'b.jpg'

}, 0, function(){$('#avant_img').attr('src','images/realisations/'+(realisation)+'b.jpg');});

Attachments (0)
Change History (5)

Changed January 30, 2009 04:24AM UTC by aaron.gundel comment:1

http://docs.jquery.com/Effects/animate The documentation states that animate is used for modifications to style properties, not attributes. I suspect that is the issue here.

Changed January 31, 2009 08:00PM UTC by EricGagnon comment:2

Yeah, but it does work on everything except Safari and Chrome. So this is a compatibility problem!

Changed January 31, 2009 09:56PM UTC by dmethvin comment:3

Right, but as aaron says, this is not a supported use of {{{.animate()}}. There are other ways of changing the image src attribute/property via the callback. Did you need some help in reworking the code to do that?

Changed February 01, 2009 01:02AM UTC by EricGagnon comment:4

I guess it might be something like:

$('#avant_img, #apres_img').fadeOut('slow',function(){

$('#avant_img').attr('src','images/realisations/'+(realisation)+'b.jpg');

$('#apres_img').attr('src','images/realisations/'+(realisation)+'a.jpg');

});

$('#avant_img, #apres_img').load(function(){$('#avant_img, #apres_img').fadeIn();});

I've submitted the bug because sometimes a little bug may hide a bigger one... So i just wanted to let you know guys!

Changed February 01, 2009 02:54AM UTC by dmethvin comment:5

resolution: → invalid
status: newclosed

Okay, cool. Sounds like you have it figured out so I'll close the ticket.