Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Other Web Development Languages (http://www.programmingforums.org/forum40.html)
-   -   zoom functionality? (http://www.programmingforums.org/showthread.php?t=11687)

ktsirig Oct 25th, 2006 4:08 AM

zoom functionality?
 
Hello,
I have some pictures on my page that I want to add zooming functionality, that is, when a visitor clicks on an image, he will be able to zoom in and out on it.
Any ideas on how this can be done?

DaWei Oct 25th, 2006 4:50 AM

It's called resizing. Google for things like bicubic, bilinear. Some languages have supportive libraries for it.

Infinite Recursion Oct 25th, 2006 7:53 AM

You could use DHTML:

http://resources.bravenet.com/script...es/image_zoom/

more: http://www.google.com/search?sourcei...tml+image+zoom

ktsirig Oct 25th, 2006 12:02 PM

well, I have something coded in Javacript that seems to work. But it changes the dimensions of the picture, while I want it to zoom in depth and not change the initial dimensions.

I have written:
<html>
<body>
<img src="picture" width="86" height="37" onclick="this.width = this.width*2; this.height = this.height*2" id="image" />
<br />
<a href="java script:void(0);" onclick="document.getElementById('image').width = document.getElementById('image').width/2; document.getElementById('image').height = document.getElementById('image').height/2;">Zoom out</a>
<br />Click on image to zoom in
</body>
</html>

DaWei Oct 25th, 2006 1:45 PM

Use the CSS clip property on your image.
style="clip: rect(toplimitpx, rightlimitpx, bottomlimitpx, leftlimitpx);"

If you want to zoom to the center, then you'll need to reposition the image to put the center in the clip region.


All times are GMT -5. The time now is 3:10 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC