thindery
thindery

Reputation: 1194

get coordinates of viewable image area

I have a working fiddle of the problem here: http://jsfiddle.net/thindery/ZHhBR/

I need to be able to grab the coordinates of the source image's viewable area and display it in the span.

Here is an example of what I mean by display the coordinates of the viewable area: http://thindery.com/jsfiddle/crop_move.html

In this example, after you zoom in and pan around, you can see four different coordinates update like this: (x,y)(x1,y1)

Does jQuery provide this functionality so I can implement it in the jsfiddle example?

Upvotes: 0

Views: 315

Answers (1)

adeneo
adeneo

Reputation: 318342

I could'nt really find a good way to get the coordinates from that plugin, so I just used a jQuery solution instead:

$(document).ready(function() {
    var iv2 = $("#viewer2").iviewer({
        src: "http://thindery.com/jsfiddle/butterfly.jpg",
        onDrag: function() {
            var pos = $("img","#viewer2").position();
            $("#status").html('X : '+Math.abs(pos.left)+'<br>Y :'+Math.abs(pos.top));
        }
    });
});

FIDDLE

Upvotes: 2

Related Questions