wally
07-07-2011, 06:01 PM
1) Script Title: Image Power Zoomer v1.1
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/powerzoomer.htm
3) Describe problem:
Hi, I use the power zoomer script in an image gallery. So I have an img that display the image selected from the thumbnails. The problem is that when I change the img src, some times the lens displays still the first image.
Here a part of my html code:
<div id="framework">
<div id='zoom1'>
<div id="preloader">
<img src="images/loader.gif" />
<span>Caricamento in corso...</span>
</div>
<img src="" alt='' title="Usa la rotella del mouse per variare lo zoom. Doppio click per aprirla." align="center" />
<script> <!-- this is only an useless attempt. playSource is called by the body onload event -->
function playSource()
{
var iPath = 'images/dojo/gallery/DSC02021.jpg';
setTimeout(function(){setSource(iPath);}, 1000);
}
</script>
</div>
<div class="jMyCarousel"> <!-- thumbnails -->
<img id="thHeader" src="images/header_thumbs.png" />
<ul>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02021.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02022.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02023.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02024.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02025.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02026.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02027.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02028.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02029.jpg" ></a></li>
</ul>
</div>
</div>
and here the setSource function:
function setSource(sender)
{
if (sender != null)
{
var src;
if (typeof sender == 'string')
src = sender;
else
src = sender.firstChild.src.replace('/thumb', '');
var $img = $('#zoom1 > img');
$img.attr('src', src);
setAspectRatio();
//the following two lines are an useless attempt to solve the problem
ddpowerzoomer.$magnifier.inner.find('img').attr('src', '');
ddpowerzoomer.$magnifier.inner.html('');
$img.addpowerzoom({
defaultpower: 2,
powerrange: [2,7],
largeimage: src, //can be null
magnifiersize: [200,200] //<--no comma following last option!
})
//ddpowerzoomer.$magnifier.image.attr('src', src);
}
}
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/powerzoomer.htm
3) Describe problem:
Hi, I use the power zoomer script in an image gallery. So I have an img that display the image selected from the thumbnails. The problem is that when I change the img src, some times the lens displays still the first image.
Here a part of my html code:
<div id="framework">
<div id='zoom1'>
<div id="preloader">
<img src="images/loader.gif" />
<span>Caricamento in corso...</span>
</div>
<img src="" alt='' title="Usa la rotella del mouse per variare lo zoom. Doppio click per aprirla." align="center" />
<script> <!-- this is only an useless attempt. playSource is called by the body onload event -->
function playSource()
{
var iPath = 'images/dojo/gallery/DSC02021.jpg';
setTimeout(function(){setSource(iPath);}, 1000);
}
</script>
</div>
<div class="jMyCarousel"> <!-- thumbnails -->
<img id="thHeader" src="images/header_thumbs.png" />
<ul>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02021.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02022.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02023.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02024.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02025.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02026.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02027.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02028.jpg" ></a></li>
<li><a href="#" onclick="setSource(this);"><img src="images/dojo/gallery/thumb/DSC02029.jpg" ></a></li>
</ul>
</div>
</div>
and here the setSource function:
function setSource(sender)
{
if (sender != null)
{
var src;
if (typeof sender == 'string')
src = sender;
else
src = sender.firstChild.src.replace('/thumb', '');
var $img = $('#zoom1 > img');
$img.attr('src', src);
setAspectRatio();
//the following two lines are an useless attempt to solve the problem
ddpowerzoomer.$magnifier.inner.find('img').attr('src', '');
ddpowerzoomer.$magnifier.inner.html('');
$img.addpowerzoom({
defaultpower: 2,
powerrange: [2,7],
largeimage: src, //can be null
magnifiersize: [200,200] //<--no comma following last option!
})
//ddpowerzoomer.$magnifier.image.attr('src', src);
}
}