I wrote some code to toggle the src of an image and also to pause/resume the jQuery cycle2 plugin.
I\'m not sure why it isn\'t working and would appreciate some help
Occasionally it actually is reasonable to want to swap the image src directly rather than handle it in CSS (working around weird bugs, mostly). What I've done in this case is written a simple helper function that toggles between the initial src and an alternate src that you can also specify on the image element itself, like so:
function toggleImgSrc(jQueryObj) {
tmp = jQueryObj.attr('src');
jQueryObj.attr('src', jQueryObj.attr('toggle_src'));
jQueryObj.attr('toggle_src', tmp);
}
and the image element itself just has an extra property called 'toggle_src' (or you could add it dynamically if you needed to):