wheelzoom icon indicating copy to clipboard operation
wheelzoom copied to clipboard

if img.src changes,wheelzoom is not work

Open maiseven opened this issue 7 years ago • 3 comments

if img.src changes,wheelzoom is not work.

demo

maiseven avatar Sep 28 '17 06:09 maiseven

Well, I found the solution. like this,

var i = 0;
var images;
	function load() {
		images = wheelzoom(document.querySelectorAll('img'), {zoom: 0.1, maxZoom: 10});
	}
	function change(){
		triggerEvent(images[0], 'wheelzoom.reset');
		triggerEvent(images[0], 'wheelzoom.destroy');
		if(i % 2 == 1){
			document.getElementById('img1').src="./img/img1.jpg";
		}else{
			document.getElementById('img1').src="./img/img2.jpg";
		}
		wheelzoom(document.querySelectorAll('img'), {zoom: 0.1, maxZoom: 10});
		i++;
	}

maiseven avatar Sep 29 '17 08:09 maiseven

Even drag is not working once src has changed

function singleImageSelector(THIS) {
	singleImage.src = THIS.src;
	//--- wheelzoom

	var images = wheelzoom(document.getElementById("idImgSingleImage"), {zoom: 0.1, maxZoom: 20})				
}
```	

ErShakirAnsari avatar Oct 29 '19 09:10 ErShakirAnsari

if loaded just change the background url in the style not the src attribute

yazidbouallagui avatar Jan 21 '21 15:01 yazidbouallagui