I'm trying to deal with this problem. I already have a few canvas (working as layers) inside a bootstrap column. For now it is working correctly in computers but I want to make the canvas responsive for mobiles.
My column is this:
<div class="col-md-8 my-container2">
<div>
<div id="fileName"> Upload a fragments file
<button id="infoPopover" type="button" class="btn btn-warning btn-xs btn-padding" data-container="body" data-toggle="popover" data-placement="right" data-content="Not file loaded" data-html="true">
?
</button>
</div>
</div>
<!-- ---------- CANVAS -------------------- -->
<div id="canvasContainer" class="col-centered">
<canvas id="myCanvasGrid" width="600" height="550"></canvas>
<canvas id="myCanvas" width="500" height="500"></canvas>
<canvas id="myCanvasLayer1" width="500" height="500"></canvas>
</div>
</div>
and this my css:
#canvasContainer{
width: 600px;
height: 550px;
margin-bottom: 25px;
}
#myCanvas {
background-color: transparent;
border:1px solid #000000;
position: absolute;
z-index: 2;
margin-top: 25px;
margin-left: 50px;
}
#myCanvasLayer1 {
background-color: transparent;
border:1px solid #000000;
position: absolute;
z-index: 1;
margin-top: 25px;
margin-left: 50px;
}
#myCanvasGrid {
background-color: white ;
border:1px solid #000000;
position: absolute;
z-index: 1;
}
I have read and try some stuff like change the width for % and so but it always crash. This is how it looks now:
And this is how it looks if I put some % instead of px:
I just want to know what should I do responsive: the column? the canvas? because If I put that the column fit the 100%x100% it looks like the second picture and the canvas don't resize.
Thanks in advance.