jquery - javascript zoom default image after change image src value -
there's problem javascript here. first, if click image zoom image. problem when image change different 1 , click, still zoom first image, not new one.
my html (container show image , zoom it)
<div class="col-md-8"> <span id='ex3' class="zoom"> <img class="img-responsive" id="myimage" width='750' height='550' src="<?php echo "./image/product/p1/". $row['item_image']. ".jpg"; ?>"> </span> </div>
my html (next image want click , zoom)
<div class="col-sm-3 col-xs-6"> <a href="#"> <img class="img-responsive portfolio-item subimage" onclick="changeimage1(); <?php $show1="./image/product/p1/". $row['item_image']. ".jpg"; ?>" src="<?php echo "./image/product/p1/". $row['item_image']. ".jpg"; ?>" alt=""> </a> </div>
my javascript in body tag
function changeimage1() { var image = document.getelementbyid('myimage'); var submage = document.getelementsbyclassname('subimage')[1].src; image.src= submage; }
my javascript in head tag (zoom function)
jquery(document).ready(function($){ $('#ex3').zoom({ on:'click' }); });
how fix it, ideas? thanks.
you missing id="ex3" in next image click zoom html. try somethng this:
jquery(document).ready(function($){ $('img').zoom({ on:'click' }); });
Comments
Post a Comment