2013-10-18 45 views
0

我在使用KineticJS v4.3.3和jQuery 2.0.3在asp.net MVC應用程序。我使用生成一個孩子:kineticJS兒童 - jquery draggable

var wrapper_div = document.getElementById('container1'); 
    var kinetic_div = wrapper_div.children[0]; 
    canvaso = kinetic_div.children[0]; 
    canvaso.setAttribute('id', "panel1"); 
    context = canvaso.getContext('2d'); 

它的偉大工程,但是當我補充一下:

$('#container1').draggable().resizable(); 

我得到以下錯誤:

Unable to get property 'setAttribute' of undefined or null reference 

會原汁原味您的建議。

回答

0

以防萬一任何人可能對解決方案感興趣。我發現,當使用可拖動和可調整大小時,通過將子[0]更改爲子[3],它增加了兩層。

var wrapper_div = document.getElementById('container1'); 
    var kinetic_div = wrapper_div.children[3]; 
    canvaso = kinetic_div.children[0]; 
    canvaso.setAttribute('id', "panel1"); 
    context = canvaso.getContext('2d');