tjp.hu » valid » zoom
AddThis Social Bookmark Button
magyar | English



JavaScript / CSS / DOM image magnifier

tjpzoom kep cime

A new version is here!

TJPzoom 3 is here with some cool new features :).

What is this?

As you may have realized, this is a tool that brings images closer. If you move your mouse over the picture, you can see a little zoom window with a magnified version of a part of the picture in it. But there is more: It works with the Internet Explorer 6, Firefox and Opera 8 browsers. New! We've received positive feedback about the Safari browser.

I want this on my homepage!

It's a piece of cake. You just have to put some lines of code in the source code of your blog / website. First of all, you have to find the following line: </head> If you got it, change it to: <script type="text/javascript" src="http://valid.tjp.hu/zoom/tjpzoom.js"></script>
</head>
(If you are tech savvy, you can save the script to your server and refer to it directly: tjpzoom.js, but it may not be the best solution.) If you are done with the changes mentioned above, we can move on to the picture itself. You will need the url address, the width and height of your picture. <div style="float:left" onmouseover="zoom_on(event,pic width,pic height,'pic url');" onmousemove="zoom_move(event);" onmouseout="zoom_off();"><img src="pic url" alt="tjpzoom picture title" style="padding:0;margin:0;border:0" /></div>
<div style="clear:both;"></div>
For example, if your picture's url is http://tjp.hu/barakk/images/200201152147.jpg, it spans 300 pixels horizontally and 239 pixels vertically, you insert the following code snippet in your code: <div style="float:left" onmouseover="zoom_on(event,300,239,'http://tjp.hu/barakk/images/200201152147.jpg');" onmousemove="zoom_move(event);" onmouseout="zoom_off();"><img src="http://tjp.hu/barakk/images/200201152147.jpg" alt="tjpzoom picture title" style="padding:0;margin:0;border:0" /></div>
<div style="clear:both;"></div>
You can put this snippet anywhere in your blog. Let's put it at the end of this sentence:
tjpzoom picture title
You may also find the tjpzoom tool useful if you you have a low resolution and a high resolution version of the same picture and it's only the lowres one that fits in your page but you want to show the little details of the highres one. In fact, that's the case with me too, I've got this http://valid.tjp.hu/zoom/collage.jpg, thats 580x580px, but I have a bigger one http://valid.tjp.hu/zoom/collage_2.jpg (with the same proportions). Don't worry, there is a solution for this: <div style="float:left" onmouseover="zoom_on(event,SMALL pic width,SMALL pic height,'SMALL pic url', 'BIG pic url');" onmousemove="zoom_move(event);" onmouseout="zoom_off();"><img src="SMALL pic url" alt="tjpzoom picture title" style="padding:0;margin:0;border:0" /></div>
<div style="clear:both;"></div>
So in my case: <div style="float:left" onmouseover="zoom_on(event,580,580,'http://valid.tjp.hu/zoom/collage.jpg', 'http://valid.tjp.hu/zoom/collage_2.jpg');" onmousemove="zoom_move(event);" onmouseout="zoom_off();"><img src="http://valid.tjp.hu/zoom/collage.jpg" alt="tjpzoom picture title" style="padding:0;margin:0;border:0" /></div>
<div style="clear:both;"></div>
I don't have to take care about the proportions of the big picture. (Anyway, this is a very big picture, it may take some time to download):
tjpzoom picture title

I want options. More options.

If you want to change the default zoom amount or the size of the zoom window, you have to change your code like this: <script type="text/javascript" src="http://valid.tjp.hu/zoom/tjpzoom.js"></script>
<script type="text/javascript"><--
var zoomw=160;
var zoomh=120;
var defzoomamount=4;
//--></script>
</head>
You can see more options if you take a look at tjpzoom.js.

Something is broken

It's possible. If something doesn't work as expected, send me the url of the page where you see the problem. My address is valid@tjp.hu. I hope we can fix it together.

So I can take this away?

Of course. But if you are a cool guy, then you will surely link this page (http://valid.tjp.hu/zoom). If you change or expand the code, please don't cut out the original credits. I'm asking for credit as I've been working on this thing for quite some time. (Not to mention the fame factor :)

Thanks

Brad Jensen was so kind to donate the project with $100. Thank you :).



Szeress: tjp.hu | bubble trouble | snapsoid
email