Resize canvas to browser's width/height (at least in IE9+), using jQuery:
Code Snippet
- <canvas id="myCanvas" width="1600px" height="1200px" style="border: 1px solid #d3d3d3;">Your browser does not support the HTML5 canvas tag.
- </canvas>
- <script type="text/javascript">
- function resizeFrame() {var h = $(window).height();var w = $(window).width();$("#myCanvas").css('height', h - 100); $("#myCanvas").css('width', w - 50);}
- $(document).ready(function () {
- jQuery.event.add(window, "load", resizeFrame);
- jQuery.event.add(window, "resize", resizeFrame);
- });
- </script>
No comments:
Post a Comment