TL; DR: An error that I cannot find prevents the plugin from working when HTML elements are injected through jQuery.
Summary: The plugin is designed if you have control over the HTML, but since I am not trying to coronate the image tag to get the "hoverzoom" attributes for the mouse, but when I add the necessary HTML attributes through jQuery functions such as .wrap(); .after(); and .addClass(); , all images disappear. I have to do this with jQuery DOM manipulation because I have no control over the HTML directly. (Don’t ask, a long story should be jQuery). It is strange that in the same sample environment (see below), if I add HTML elements, IDs and classes, the plugin works. But if I try to add all the necessary attributes to a tag with an open tag, it will disappear.
Theory: Image tags seem to disappear as soon as <ul> has id="etalage" (as dictated by the plugin’s deployment guidelines), and when the <img> tags have corresponding classes, designating them as source and thumb images. In my theory, there is a CSS rule “display: none”, but if this is true, then should not another example work that works on the page?
Plugin: Etalage on Canyon (I would post a link, but Stack tells me that I'm too young to post more than one link)
Example error page: in the wild (comments can be seen at the inspector)
My code (which doesn't work) HTML:
<img id="thumbImage" src="http://placekitten.com.s3.amazonaws.com/homepage-samples/408/287.jpg" alt="" />
JQuery
$(document).ready(function(){ $('#thumbImage').wrap('<ul id="etalage"><li /></ul>') .addClass('etalage_thumb_image') .after('<img class="etalage_source_image target" />'); $('.etalage_source_image') .attr('src', 'http://placekitten.com.s3.amazonaws.com/homepage-samples/200/140.jpg'); });
According to Etalage, this is code that works.
HTML
<ul id="etalage"> <li> <img class="etalage_thumb_image" src="xyz.jpg"> <img class="etalage_source_image target" src="xyz.jpg"> </li> </ul>
I am so lost. I appreciate in advance if anyone can help. I posted to their help forum, but SO was so helpful in debugging my code in the past.