Jcropæ¯ä¸ä¸ªåè½å¼ºå¤§çå¾åè£åªå¼æ
Jcropæ¯ä¸ä¸ªåè½å¼ºå¤§çå¾åè£åªå¼æjQueryçã
å®ç设计使å¼å人åå¯ä»¥å¾å®¹æå°ç´æ¥éæäºå è¿çå¾åè£åªåè½éæå°ä»»ä½åºäºWebçåºç¨ç¨åºå¨ä¸çºç²å¨ååçµæ´»æ§ï¼æç¼ç ï¼æµè¯åè°è¯çææï¼ãJcropè¿è®¾æå¹²åï¼ç»ç»è¯å¥½ç代ç ï¼å¨å¤§å¤æ°ç°ä»£çwebæµè§å¨ææå¾å¥½ã
å¨<HEAD>ä½ éè¦å è½½å¿ è¦æä»¶çé¡µé¢ è¿å æ¬ï¼
jQueryåº
JcropçJavascript
Jcrop CSSæ ·å¼è¡¨
å®åºè¯¥æ¯è¿ä¸ªæ ·åï¼
- <scriptsrc="js/jquery.min.js"></SCRIPT>
- <scriptsrc="js/jquery.Jcrop.min.js"></SCRIPT>
- <linkrel="stylesheet"href="css/jquery.Jcrop.css"type="text/css"/>
å ¥é¨ç¬¬ä¸ä¸ªç®åç¹çDemo:
- <%@pagelanguage="java"contentType="text/html;charset=UTF-8"
- pageEncoding="UTF-8"%>
- <!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <metahttp-equiv="Content-Type"content="text/html;charset=ISO-8859-1">
- <title>Inserttitlehere</title>
- <scriptsrc="http://code.jquery.com/jquery-1.10.1.min.js"></script>
- <scriptsrc="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
- <scriptsrc="js/jquery.Jcrop.min.js"></script>
- <linkrel="stylesheet"href="css/jquery.Jcrop.css"type="text/css"/>
- <script>
- jQuery(function(){
- jQuery('#user_preview_img').Jcrop({
- trackDocument:true
- });
- });
- </script>
- </head>
- <body>
- <imgalt=""src="images/area1/1.jpg"id="user_preview_img">
- </body>
- </html>
ææå¾ï¼
jcropç®åçäºä»¶å¤çDemo:
- <%@pagelanguage="java"contentType="text/html;charset=UTF-8"
- pageEncoding="UTF-8"%>
- <!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <metahttp-equiv="Content-Type"content="text/html;charset=ISO-8859-1">
- <title>Inserttitlehere</title>
- <scriptsrc="http://code.jquery.com/jquery-1.10.1.min.js"></script>
- <scriptsrc="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
- <scriptsrc="js/jquery.Jcrop.min.js"></script>
- <linkrel="stylesheet"href="css/jquery.Jcrop.css"type="text/css"/>
- <script>
- jQuery(document).ready(function(){
- jQuery('#user_preview_img').Jcrop({
- onChange:showCoords,
- onSelect:showCoords
- });
- });
- //Simpleeventhandler,calledfromonChangeandonSelect
- //eventhandlers,aspertheJcropinvocationabove
- functionshowCoords(c)
- {
- jQuery('#x1').val(c.x);
- jQuery('#y1').val(c.y);
- jQuery('#x2').val(c.x2);
- jQuery('#y2').val(c.y2);
- jQuery('#w').val(c.w);
- jQuery('#h').val(c.h);
- };
- </script>
- </head>
- <body>
- <div><imgalt=""src="images/area1/1.jpg"id="user_preview_img"></div>
- <formonsubmit="returnfalse;"class="coords">
- <label>X1<inputtype="text"size="4"id="x1"name="x1"/></label>
- <label>Y1<inputtype="text"size="4"id="y1"name="y1"/></label>
- <label>X2<inputtype="text"size="4"id="x2"name="x2"/></label>
- <label>Y2<inputtype="text"size="4"id="y2"name="y2"/></label>
- <label>W<inputtype="text"size="4"id="w"name="w"/></label>
- <label>H<inputtype="text"size="4"id="h"name="h"/></label>
- </form>
- </body>
- </html>
ææå¾ï¼
jcropå®ä¾æ¼ç¤ºDemo3ï¼
- <%@pagelanguage="java"contentType="text/html;charset=UTF-8"
- pageEncoding="UTF-8"%>
- <!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <metahttp-equiv="Content-Type"content="text/html;charset=ISO-8859-1">
- <title>Inserttitlehere</title>
- <scriptsrc="http://code.jquery.com/jquery-1.10.1.min.js"></script>
- <scriptsrc="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
- <scriptsrc="js/jquery.Jcrop.min.js"></script>
- <linkrel="stylesheet"href="css/jquery.Jcrop.css"type="text/css"/>
- <script>
- jQuery(document).ready(function(){
- jQuery('#user_preview_img').Jcrop({
- onChange:showCoords,
- onSelect:showCoords,
- bgColor:'red',
- bgOpacity:.4,
- setSelect:[100,100,50,50],
- aspectRatio:16/9
- });
- });
- //Simpleeventhandler,calledfromonChangeandonSelect
- //eventhandlers,aspertheJcropinvocationabove
- functionshowCoords(c)
- {
- jQuery('#x1').val(c.x);
- jQuery('#y1').val(c.y);
- jQuery('#x2').val(c.x2);
- jQuery('#y2').val(c.y2);
- jQuery('#w').val(c.w);
- jQuery('#h').val(c.h);
- };
- </script>
- </head>
- <body>
- <div><imgalt=""src="images/area1/1.jpg"id="user_preview_img"></div>
- <formonsubmit="returnfalse;"class="coords">
- <label>X1<inputtype="text"size="4"id="x1"name="x1"/></label>
- <label>Y1<inputtype="text"size="4"id="y1"name="y1"/></label>
- <label>X2<inputtype="text"size="4"id="x2"name="x2"/></label>
- <label>Y2<inputtype="text"size="4"id="y2"name="y2"/></label>
- <label>W<inputtype="text"size="4"id="w"name="w"/></label>
- <label>H<inputtype="text"size="4"id="h"name="h"/></label>
- </form>
- </body>
- </html>
ææå¾ï¼
Jcropå®ä¾Demo4:
- <%@pagelanguage="java"contentType="text/html;charset=UTF-8"
- pageEncoding="UTF-8"%>
- <!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <metahttp-equiv="Content-Type"content="text/html;charset=ISO-8859-1">
- <title>Inserttitlehere</title>
- <scriptsrc="http://code.jquery.com/jquery-1.10.1.min.js"></script>
- <scriptsrc="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
- <scriptsrc="js/jquery.Jcrop.min.js"></script>
- <linkrel="stylesheet"href="css/jquery.Jcrop.css"type="text/css"/>
- <scripttype="text/javascript">
- jQuery(function($){
- //Createvariables(inthisscope)toholdtheAPIandimagesize
- varjcrop_api,
- boundx,
- boundy,
- //Grabsomeinformationaboutthepreviewpane
- $preview=$('#preview-pane'),
- $pcnt=$('#preview-pane.preview-container'),
- $pimg=$('#preview-pane.preview-containerimg'),
- xsize=$pcnt.width(),
- ysize=$pcnt.height();
- console.log('init',[xsize,ysize]);
- $('#user_preview_img').Jcrop({
- onChange:updatePreview,
- onSelect:updatePreview,
- aspectRatio:xsize/ysize
- },function(){
- //UsetheAPItogettherealimagesize
- varbounds=this.getBounds();
- boundx=bounds[0];
- boundy=bounds[1];
- //StoretheAPIinthejcrop_apivariable
- jcrop_api=this;
- //Movethepreviewintothejcropcontainerforcsspositioning
- $preview.appendTo(jcrop_api.ui.holder);
- });
- functionupdatePreview(c)
- {
- if(parseInt(c.w)>0)
- {
- varrx=xsize/c.w;
- varry=ysize/c.h;
- $pimg.css({
- width:Math.round(rx*boundx)+'px',
- height:Math.round(ry*boundy)+'px',
- marginLeft:'-'+Math.round(rx*c.x)+'px',
- marginTop:'-'+Math.round(ry*c.y)+'px'
- });
- }
- };
- });
- </script>
- <styletype="text/css">
- /*Applythesestylesonlywhen#preview-panehas
- beenplacedwithintheJcropwidget*/
- .jcrop-holder#preview-pane{
- display:block;
- position:absolute;
- z-index:2000;
- top:10px;
- right:-280px;
- padding:6px;
- border:1pxrgba(0,0,0,.4)solid;
- background-color:white;
- -webkit-border-radius:6px;
- -moz-border-radius:6px;
- border-radius:6px;
- -webkit-box-shadow:1px1px5px2pxrgba(0,0,0,0.2);
- -moz-box-shadow:1px1px5px2pxrgba(0,0,0,0.2);
- box-shadow:1px1px5px2pxrgba(0,0,0,0.2);
- }
- /*TheJavascriptcodewillsettheaspectratioofthecrop
- areabasedonthesizeofthethumbnailpreview,
- specifiedhere*/
- #preview-pane.preview-container{
- width:250px;
- height:170px;
- overflow:hidden;
- }
- </style>
- </head>
- <body>
- <div><imgalt=""src="images/area1/1.jpg"id="user_preview_img"></div>
- <divid="preview-pane">
- <divclass="preview-container">
- <imgsrc="images/area1/1.jpg"class="jcrop-preview"alt="Preview"/>
- </div>
- </div>
- </body>
- </html>
ææå¾:
注æï¼æå
³è¿äºé项çå¯¹è±¡çæ ¼å¼çå ä»¶äºæ
ï¼
ææ¬å¼å¿
é¡»å å¼å·ï¼å¦'红'ï¼'ï¼CCCâï¼âRGBï¼10,10,10ï¼'ï¼
æ°å¼ï¼å
æ¬å°æ°ç¹ï¼ä¸åºè¯¥è¢«å¼ç¨ã
setSelect带æä¸ä¸ªæ°ç»ï¼è¿é表示为ä¸ä¸ªæ°ç»ææ¬
aspectRatioå¯è½æ¯æç®åçé¤ä»¥å®½åº¦/é«åº¦è®¾ç½®
å颿²¡æéå·çæåä¸ä¸ªé项
jQuery(function(){
});
å
¨å为
jQuery(document).ready(function(){
});
<wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="font-family:simsun; font-size:14px; line-height:21px"><span style="color:#ff0000"><span style="font-family:simsun; font-size:14px; line-height:21px"></span><wbr style="font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; line-height:21px"></span><wbr style="font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; line-height:21px"></span><wbr style="font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; line-height:21px">3.常ç¨é项设置</span></wbr></wbr></wbr></span><br style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px">aspectRatio:éä¸åºåæå®½/髿¯ï¼ä¸º1è¡¨ç¤ºæ£æ¹å½¢ã</span><br style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px">minSize:æå°ç宽ï¼é«å¼ã</span><br style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px">maxSize:æå¤§ç宽ï¼é«å¼ã</span><br style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px">setSelect:设置åå§éä¸åºåã</span><br style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px">bgColor:èæ¯é¢è²</span><br style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px">bgOpacity:èæ¯éæåº¦ã</span><br style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px">allowResize:æ¯å¦å
许æ¹åéä¸åºå大å°ã</span><br style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px"></span><wbr style="color:rgb(73,73,73); font-family:simsun; font-size:14px; line-height:21px"><span style="font-family:simsun; font-size:14px; color:#494949; line-height:21px">allowMove:æ¯å¦å
许移å¨éä¸åºåã</span></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
- $(function(){
- $("#demoImage").Jcrop({
- aspectRatio:1,//éä¸åºå宽髿¯ä¸º1ï¼å³éä¸åºåä¸ºæ£æ¹å½¢
- bgColor:"#ccc",//è£åªæ¶èæ¯é¢è²è®¾ä¸ºç°è²
- bgOpacity:0.1,//éæåº¦è®¾ä¸º0.1
- allowResize:false,//ä¸å 许æ¹åéä¸åºåç大å°
- setSelect:[0,0,100,100]//åå§åéä¸åºå
- }
- );
- }
- );
4.apiç¨æ³
api.disable();<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>//设置为ç¦ç¨è£åªææ
api.enable();<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>//设置为å¯ç¨è£åªææ
api.setOptions({allowResize:false});//设置ç¸åºé ç½®
api.setSelect([0,0,100,100]);<wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>//设置éä¸åºå
- $(function(){
- //äºä»¶å¤ç
- $("#demoImage").Jcrop(
- {
- onChange:showCoords,//å½éæ©åºåååçæ¶åï¼æ§è¡å¯¹åºçåè°å½æ°
- onSelect:showCoords//å½éä¸åºåçæ¶åï¼æ§è¡å¯¹åºçåè°å½æ°
- }
- );
- }
- );
- functionshowCoords(c){
- $("#txtX1").val(c.x);//å¾å°éä¸åºåå·¦ä¸è§æ¨ªåæ
- $("#txtY1").val(c.y);//å¾å°éä¸åºåå·¦ä¸è§çºµåæ
- $("#txtX2").val(c.x2);//å¾å°éä¸åºåå³ä¸è§æ¨ªåæ
- $("#txtY2").val(c.y2);//å¾å°éä¸åºåå³ä¸è§çºµåæ
- $("#txtWidth").val(c.w);//å¾å°éä¸åºåç宽度
- $("#txtHeight").val(c.h);//å¾å°éä¸åºåçé«åº¦
- }