Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: PHP + JQUERY pagalbos...

Parašė lasin· 2012 Gru. 17 21:12:05
#3


echo"<script type='text/javascript'>
//<![CDATA[
var cropImage = function(target, container, coordinateContainer, topCoord, leftCoord){
 var img = $(target);
 var imgSizeRatio = img.getSize().x / img.getSize().y;
 var desiredRatio = 83 / 68;
 if (imgSizeRatio > desiredRatio) {
 
 }else{
  img.setStyle('width','1040px'); 
 }
 var myDragScroller = new Drag(container, {
  snap:0,
  style: false,
  invert: true,
  modifiers: {x: 'scrollLeft', y: 'scrollTop'},
  onComplete: function(el){
   var cropCutFromTop = img.getCoordinates($(coordinateContainer)).top;
   var cropCutFromLeft = img.getCoordinates($(coordinateContainer)).left;
    $(topCoord).set('value',cropCutFromTop);
    $(leftCoord).set('value',cropCutFromLeft);
 
  }
 });
}
window.addEvent('load', function(){ // important do not use domReady since we want the image to be loaded
 document.ondragstart = function () { return false; }; //IE drag hack 
 cropImage('imgPhoto', 'crop-iholder', 'crop-holder', 'hdnInpTop', 'hdnInpLeft');
 });
//]]> 
</script>";