문제

I try to update the color of a shape but it does not change (although F12 says, that the attribute is updated)

 <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> 
도움이 되었습니까?

해결책

Using prop instead off attr solves the problem

 <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> 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top