I'm using Jquery cycle on images loaded with Ajax. Captions for each image are loaded with Jquery.Cycle's onBefore option and a separate function, as seen below:
$('#full-wrap').cycle({
before
: onBefore
});
};
function onBefore() {
$
('.caption')
.html('Opposite: ' + this.alt);
};
The problem is that because the data is being loaded via Ajax, and because Jquery.Cycle is being called as a success function of the Ajax script, the caption text from each image set is being "cached" somehow, causing them to cycle randomly when subsequent sets are loaded.
It was suggested to me that this is being caused by the caption-getting event being fired multiple times on each load, which seems to be true. But setting
event.stopPropagation
as part of the function just caused
all subsequent events to fail, even ones on the parent. I also tried removing the caption div and adding it back in as a separate function (using Jquery.Cycle's
onAfter
option), and while successful in that the captions were now correct for each image set, they flickered due to the div being removed and added too quickly.
Here's a live link so you can see what I'm talking about. The deadline for this project is tomorrow, and I've been flummoxed by this for days. I'd be eternally grateful for any solutions you can offer.