trepmag / jrac

jQuery Resize And Crop (jrac) is a jQuery plugin that build a viewport around a given image permitting to visually resize an image and place a crop
GNU General Public License v2.0
137 stars 50 forks source link

zoom from center #2

Closed chuja3 closed 13 years ago

chuja3 commented 13 years ago

hi,

plz how can i make a zoom start from center of image.

trepmag commented 13 years ago

Hello chuja3,

You could do this in the jrac 'viewport_onload' callback by doing something like that:

$('img').jrac({
    'viewport_onload': function() {
        var $viewport = this;
        var $image = $viewport.$image;
        var x = $image.width()/2;
        var y = $image.height()/2;
        $viewport.observator.set_property('crop_x',x);
        $viewport.observator.set_property('crop_y',y);
      }
});