javascript - Canvas : Getting rid of style attribute -
how rid of style automatically generated canvas?
chrome: <canvas id="g_2" width="604" height="304" style="-webkit-user-select: none; touch-action: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); width: 302px; height: 152px;"></canvas> firefox: <canvas height="157" width="1076" style="-moz-user-select: none; width: 302px; height: 152px;" id="g_2"></canvas>
p.s : not using javascript add style.
to create canvas, using angularjs ng-repeating on canvas element using array, add new canvas , index appended array. here code snippet:
<div class="tab-content" data-ng-repeat="tab in somearray"> <div role="tabpanel" class="tab-pane active"> <canvas id="someid_[[tab]]"></canvas> </div> </div>
after canvas element created, setting width , height follows:
var canvas = document.getelementbyid(canvasid); canvas.width = width; canvas.height = height;
when set canvas height , width set style
var canvas = document.getelementbyid(canvasid); canvas.width = width; canvas.height = height; canvas.style = '';
Comments
Post a Comment