How to set the size of canvas according to div size in tizen

How to set the size of canvas according to div size in tizen

BY 06 Aug 2015 Web Application Development

i want  if div size width:100%;height:100% then also canvas size is width:100%;height:100%  (not using pix)

 

 

<div id=”parent” style=”position:absolute;background-size:100% 100%;background-color:blue;width:100%;height:100%”>
        <canvas id=”theCanvas” style=”background-color: red;”>
        </canvas>
    </div>

<script>
$(document).ready(function() {
  var canvas = document.getElementById(“theCanvas”);
  canvas.width = $(“#parent”).width();
  canvas.height = $(“#parent”).height();
  canvas.position = $(“#parent”).position();
  canvas.background-size = $(“#parent”).background-size();
});
</script>

Written by