javascript - Function if checkbox checked and a different function if not checked? -
my mesh update position if radio button id m1 checked.
i tried reach mesh going it's original position if "#m1" not checked more.
do have fire function if checked , different function if not checked?
<input id="m1" type="radio" name="radio" value=""> <input id="mx" type="radio" name="radio" value=""> var geometry = new three.boxgeometry( 1, 0.05, 1 ); var mesh = new three.mesh( geometry); mesh.position.set( 0, 0.012, 0 ); mesh.scale.set( 1, 1, 2 ); mesh.add( plane ); $('#m1').change(function() { if(this.checked) { var tween = new tween.tween(mesh.position).to({ x: 0, y: 0.112, z:0 }, 2000).start(); tween.easing(tween.easing.cubic.in); tween.yoyo(true); } });
jquery
$('#m1').on("change", function() { if($(this).prop("checked") == true) { var tween = new tween.tween(mesh.position).to({ x: 0, y: 0.112, z:0 }, 2000).start(); tween.easing(tween.easing.cubic.in); tween.yoyo(true); } else { // stuff } });
Comments
Post a Comment