jQuery .click() not working in Internet Explorer 9/10 -
the below part of larger project (obviously) , it's working fine in chrome, firefox , opera .click() functions aren't being called ie9 or 10.
jquery('.current img').hover(function() { var thiselem = jquery(this); thiselem.parent().parent().find('.hotspot span:not(.select-image)').remove(); thiselem.parent().parent().find('.hotspot img').parent().find('span.select-image').remove(); jquery('<span class="zoom-out"></span>').prependto(thiselem.parent()).click(function() { z -= .1; z = math.max(z, 1); jquery(this).parent().find('img').attr('src', '<?php echo $urlprefix; ?>/zcard-thumbnail-image/photos/<?php echo $modelid; ?>/low/' + + '/' + (w * z) + '/' + (h * z) + '/file'); }); jquery('<span class="select-image"></span>').prependto(thiselem.parent()); jquery('<span class="zoom-in"></span>').prependto(thiselem.parent()).click(function() { z += .1; z = math.min(z, 5); jquery(this).parent().find('img').attr('src', '<?php echo $urlprefix; ?>/zcard-thumbnail-image/photos/<?php echo $modelid; ?>/low/' + + '/' + (w * z) + '/' + (h * z) + '/file'); }); });
as far can tell, .click() isn't binding because elements don't yet exist. if instead use jquery(target).prepend(element), alert delay further execution, , .click() binds, works fine. unfortunately replacing alerts delay() doesn't result in same.
does have suggestions please?
if can create selector identify elements, use delegate() attach handlers - works elements don't exist yet.
Comments
Post a Comment