I would try using remove or replaceWith (both jQuery functions available because this script already requires jQuery). If replaceWith works, great. Otherwise you would have to remove and then append, or before and then remove. The remove command is supposed to kill everything about any element removed using it (like events and attributes assigned via jQuery). So let's say you have something like so:
Code:
<div id="imgholder">
<img src="ocean.gif" style="width:200px; height:150px">
</div>
And let's say you already initialized it in the head of the page like so:
Code:
<script type="text/javascript">
jQuery(document).ready(function($){ //fire on DOM ready
$('#imgholder, img').addpowerzoom()
})
</script>
Later you could run code like this:
Code:
jQuery('#imgholder, img').replaceWith('<img src="someother.jpg" style="width:250px; height:175px">');
jQuery('#imgholder, img').addpowerzoom();
which would replace that image with another, and then initialize the new image to power zoom.
or maybe you need remove, in which case it would go like so:
Code:
jQuery('#imgholder, img').remove();
jQuery('#imgholder').append('<img src="someother.jpg" style="width:250px; height:175px">');
jQuery('#imgholder, img').addpowerzoom();
I think I can run these scenarios on the demo page using the console to see if either or both work, and if anything else is required. But I might not be able to test that way.
In any case, do you know how to use the code I just gave you? You could make it a function and/or a click event for some element the user would click on to switch to that new image. Changing back would be like:
Code:
jQuery('#imgholder, img').replaceWith('<img src="ocean.gif" style="width:200px; height:150px">');
jQuery('#imgholder, img').addpowerzoom();
or (using remove and append):
Code:
jQuery('#imgholder, img').remove();
jQuery('#imgholder').append('<img src="ocean.gif" style="width:200px; height:150px">');
jQuery('#imgholder, img').addpowerzoom();
Whichever works, assuming at least one of them does, replaceWith is easier if it works, you can keep on changing the image in this fashion whenever you like, to whatever image you like.
Edit: Added later - Just tested this and the replaceWith method appears to work fine.
Bookmarks