PDA

View Full Version : jQuery Image Magnify v1.1 - close/minify glass



xxmewstarxx
07-28-2010, 08:48 PM
1) Script Title: :: jQuery Image Magnify v1.1

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

3) Describe problem:

I would really like to add either an "X" Or "Close" in a corner or add a minify glass after the image is large. I love that magnify glass to enlarge but I have had stupid people come to the site and complain they dont know how to close the image. Any help would be great. Thanks in advance.

Mike

ddadmin
07-29-2010, 08:42 AM
Try the below modified .js file, which lets you add a "close" image on top of the magnified image (lower right corner by default). Inside the .js file, modify this line:


var $closeimage=$('<img src="zoomout.gif" style="z-index:10000; position:absolute;display:none" />').appendTo(document.body)

Change the file name in red to point to the full path to your own close image. Then for this line:


$closeimage.css({left:imageinfo.newattrs.x+$clone.width()-30, top:imageinfo.newattrs.y+$clone.height()-30}).show()

You may want to modify 30 and 30 to reflect the dimensions of the close image, so it appears snug next to the lower right corner of the magnified image.

xxmewstarxx
07-30-2010, 03:56 PM
Thanks ddadmin that helps alot.

The only thing it doesnt do, is make the image clickable to close it. But I just made my image say click image to close and that helps so much. Thanks again. If theres an easy way to make the image clickable that would be cool but if not, no worries this already helps a 1000 times. :D

ddadmin
07-30-2010, 08:11 PM
You're welcome. To your followup question, isn't the entire magnified image clickable already by default? Or do you mean something else?

xxmewstarxx
07-31-2010, 02:33 AM
ddadmin, yes the full sized image is clickable. But when I added my close button the button I made was kinda big and if you click on the close button, nothing would happen. You would have to click on the image so I just changed the close image to say "Click image to close" instead of having to click on the Image "Close(x)"