PDA

View Full Version : Auto retract



kenrogers
10-14-2009, 04:39 PM
1) Script Title: jQuery Image Magnify

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex4/imagemagnify.htm

3) Describe problem: This works great! My only wish is that when clicking on another image, the previous image would retract automatically. I've observed users looking at an array of 10 by 5 images and getting four or five on top of each other before going back to click on the big ones to remove them.

jscheuer1
10-15-2009, 07:10 AM
Add the highlighted code as shown to the jquery.magnifier.js file:


magnify:function($, $target, options){
var setting={} //create blank object to store combined settings
var setting=jQuery.extend(setting, this.dsettings, options)
var effectpos=this.imgshells.length
var attrs={w:$target.outerWidth(), h:$target.outerHeight()}
var newattrs={w:Math.round(attrs.w*setting.magnifyby), h:Math.round(attrs.h*setting.magnifyby)}
$target.css('cursor', jQuery.imageMagnifier.cursorcss)
var $clone=$target.clone().css({position:'absolute', left:0, top:0, visibility:'hidden', border:'1px solid gray', cursor:'pointer'}).appendTo(document.body)
$target.add($clone).data('pos', effectpos) //save position of image
this.imgshells.push({$target:$target, $clone:$clone, attrs:attrs, newattrs:newattrs}) //remember info about this warp image instance
$target.bind('click.magnify', function(e){ //action when original image is clicked on
$('.magnify').each(function(){
var s = this.style;
if(s.visibility === 'visible' && s.position === 'absolute' && s.cursor === 'pointer')
$(this).click();
});
var $this=$(this).css({opacity:setting.imgopacity})
var imageinfo=jQuery.imageMagnifier.imgshells[$this.data('pos')]
jQuery.imageMagnifier.refreshoffsets($(window), $this, imageinfo) //refresh offset positions of original and warped images
var $clone=imageinfo.$clone
$clone.stop().css({zInd . . .

kenrogers
10-15-2009, 12:22 PM
Thanks John. Worked like a charm! I tried using your expando script to start with but for an array of this size there is just too much moving of other images around. Now the magnify script with auto retract is great! Ken Rogers

kiosklim
10-22-2009, 04:57 AM
Thanks John. Worked like a charm! I tried using your expando script to start with but for an array of this size there is just too much moving of other images around. Now the magnify script with auto retract is great! Ken Rogers

den how to change the position(location) of where the magnified image display??

jscheuer1
10-22-2009, 06:36 AM
den how to change the position(location) of where the magnified image display??

Please start a new thread for a new question.