Created
September 27, 2013 15:54
-
-
Save kaspergrubbe/6730806 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('.jcrop').on('load', function(){ | |
| image = $(this); | |
| ratio = image.data('ratio').split('x'); | |
| ratio = parseFloat(ratio[0]) / parseFloat(ratio[1]); | |
| x1 = image.data('x1'); | |
| y1 = image.data('y1'); | |
| x2 = image.data('x2'); | |
| y2 = image.data('y2'); | |
| width = image.data('width'); | |
| height = image.data('height'); | |
| image.Jcrop({ | |
| setSelect: [ x1, y1, x2, y2 ], | |
| aspectRatio: ratio, | |
| trueSize: [width, height], | |
| onChange: $.proxy( showCoords, this ), | |
| onSelect: $.proxy( showCoords, this ) | |
| }); | |
| function showCoords(c) | |
| { | |
| var image = $(this); | |
| var ratio = image.data('ratio'); | |
| $('#'+ratio+" .x1").val(c.x); | |
| $('#'+ratio+" .y1").val(c.y); | |
| $('#'+ratio+" .crop_width").val(c.w); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment