wheelzoom
wheelzoom copied to clipboard
if img.src changes,wheelzoom is not work
if img.src changes,wheelzoom is not work.
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++;
}
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})
}
```
if loaded just change the background url in the style not the src attribute