jquery - elevatezoom on responsive image -
i'm using this plugin zoom image on site.
my site responsive , try make inner zoom responsive it's not working. if make window smaller inner zoom stay big.
<div class="img_container"> <img id="image1" src="https://encrypted-tbn2.gstatic.com/images?q=tbn:and9gcsidxry6nqeuhz8yydpkjagc9avqtal84ldgsmnx71mqob-tqrw" class="image1"> </div>
$('#image1').elevatezoom({ responsive : true, bordersize : 1, bordercolour : '#ccc', zoomtype : 'inner', cursor: 'crosshair' });
.img_container { width: 100% } .image1 { min-width: 100%; display: block; max-width: 100%; height: auto; }
actually, i'm seeing plugin responsive on load. if refresh page when browser width 320px inner zoom 320px. if change browser size inner zoom won't change.
this worked me removing , adding data $(".active-zoom") :
var $zoomimg = $(".active-zoom"); zoomconfig = { gallery:'thumbnails', cursor: 'inherit', galleryactiveclass: 'active', imagecrossfade: true, zoomwindowfadein: 500, zoomwindowfadeout: 500, lensfadein: 500, lensfadeout: 500, bordersize:0, zoomtype:'inner', containlenszoom: 1, responsive:true } $zoomimg.elevatezoom(zoomconfig); $(window).resize(function(){ var height = $zoomimg.height(); $(".zoomwrapper").css("height", height); $(".zoomcontainer .zoomwindow").css({"height": height}); $zoomimg.removedata('elevatezoom'); $('.zoomcontainer').remove(); settimeout(function() { $(".active-zoom").elevatezoom(zoomconfig); }, 90) });
css:
img.active-zoom { height: auto !important; width: 100% !important }
Comments
Post a Comment