/    Sign up×
Community /Pin to ProfileBookmark

I want to give functionality of Zooming the image i.e when the user will drag his mouse over the image the selected area will be zoomed for him. Can anyone suggest me a solution..

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@NevermoreMay 28.2003 — You would either need to use Flash or Java, neither of which am I familiar with. From the title of this thread I imagin you have heard of the program Image Zoom, which creates Java applets to allow zooming in on and rotating of images.
Copy linkTweet thisAlerts:
@ajsharmaauthorMay 28.2003 — Dear cijori !

Thanx for considering the thread. Actually what i need is zooming the selected map area on the website. I have written a DLL which can zoom the image but for that i require the starting XY coordinate and ending XY coordinates of selection. Can you suggest me some way by which i can get XY coordinates while dragging mouse on image.
Copy linkTweet thisAlerts:
@khalidali63May 28.2003 — Suppose your image element has an id attribute

say

<imag id="img1"

you can probably do this then

var obj = document.getElementById("img1");

now you can get the Xand Y co-ords of the image with reference to its position in a given window.

var imgX = obj.offsetLeft;

var imgY = obj.offsetTop;

once you have that now you want to get X and Y positions of your mouse

which you can get in this way

capture mousedown,mouseup and mousemove events

var x = event.clientX

var y = event.clientY

and use pageX and pageY for netscape browsers.

Once you have all the co-ords,you can (I hope) calculate the co-ords for image map zooming and use ur dll..
Copy linkTweet thisAlerts:
@ajsharmaauthorMay 29.2003 — Dear Khalid !

Thanx a lot for your suggestion. Your suggestion has worked but it is giving me problem when the images are inserted into a column of a table, as it gives both offsetLeft and offsetTop as 0 in that case. Can you please suggest me any solution over that.

Regards Ajay
Copy linkTweet thisAlerts:
@khalidali63May 29.2003 — I think you can use a wrok around this crappy behaviour.

giv an id attribute the external most table element and get the offsetLeft with reference to that element.you should be able to make it work that way...If you have any difficulties let me know.
Copy linkTweet thisAlerts:
@ajsharmaauthorJun 02.2003 — Dear Khalid !

Thanx a lot for providing the solution, the way around you told has really worked. Once again thanx a lot.

Regards Ajay
×

Success!

Help @ajsharma spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...