Any Idea how to zoom in a image on particular point using javascript
, css
? I am using webkit
based browser.
I can zoom by specifying zoom property , like `elem.style.zoom="150%", Main problem is I cannot center the image where I want to zoom. I can get the point where I want to zoom using mouseclick.
What has to be done.
if you do not mind using jQuery for it then use the following (tested)
and the html needed
As I said in my comment above, I would avoid the zoom css property and stick to just javascript. I managed to throw together the following code which works pretty well for the first click, really all it needs is a little more dynamically (even a word?).
It works in Google Chrome and IE, not sure about others. Like I said hopefully it will point you in the right direction.
In following code, the image is amplified at the mouse click point - the image is amplified, but the point where you clicked remains under your mouse cursor, and the size of the frame remains the same. Right-click to go back to original display ratio.