2015-04-21 28 views
1

我已經創建了一個應用程序使用cropper.js裁剪圖像,應用程序正在工作,圖像即將來臨,但我無法裁剪圖像。我的代碼如下無法裁剪圖像

給出誰能告訴我,這

Plunker

HTML

<div class="container"> 
    <img src="http://fengyuanchen.github.io/cropper/img/picture.jpg" /> 
</div> 

腳本

$('.container > img').cropper({ 
    aspectRatio: 16/9, 
    crop: function(data) { 
    // Output the result data for cropping image. 
    } 
}); 
0一些解決方案
+0

被渲染你不東東點設置一個'aspectRatio'? – atmd

+0

是強制性的,我們如何設置 –

+0

根據舉例給出你已鏈接到github回購 – atmd

回答

0

您需要解僱你的種植者代碼在文檔準備好塊,像這樣:

$(function(){ 
    $('.container > img').cropper({ 
     aspectRatio: 16/9, 
     crop: function(data) { 
     // Output the result data for cropping image. 
     } 
    }); 
}); 

你在哪裏運行作物碼之前的圖像已經在DOM

+0

你能給我一個工作的重擊者 –