2013-10-04 182 views
0

我嘗試更新形狀的顏色,但它不會改變(雖然F12說,該屬性被更新)X3DOM更新屬性

<transform scale="10 10 10" onmousedown="$('#matT').attr('diffuseColor', '0 0 1');">    
     <shape def="boxshape11"> 
      <appearance def="boxApp11"> 
       <material id="matT" diffuseColor="1 1 0" specularColor=".5 .5 .5" /> 
      </appearance> 
      <box def="box1" /> 
     </shape> 
    </transform> 

回答

1

使用prop而不是關閉attr解決問題

<transform scale="10 10 10" onmousedown="$('#matT').prop('diffuseColor', '0 0 1');">    
     <shape def="boxshape11"> 
      <appearance def="boxApp11"> 
       <material id="matT" diffuseColor="1 1 0" specularColor=".5 .5 .5" /> 
      </appearance> 
      <box def="box1" /> 
     </shape> 
    </transform>