I'm using a canvas html5 overlapping my web page.
<div id="wrapper">
<div id="copy">
<div id="text">
<p><span class="name">title</span><br>
</div><!--text-->
</div><!--copy-->
<div class="info">
<p><span class="holding">text</span></p>
</div><!--info-->
</div><!--wrapper-->
<div id="container">
<canvas id="canvasTop" width="512" height="512" onMouseDown="handleMouseDown(event)" onmousemove="handleMouseMove(event)" onMouseup="handleMouseUp(event)" onmouseout="handleMouseOut(event)"></canvas>
</div><!--container-->
I'm trying to hide the canvas on mobile devices through media query.
@media screen and (max-width: 1024px){
#container {
display:none;
}
}
It works when I resize the screen on my desktop, both on Chrome and Safari, but not on my iPhone!
I've tried to find a solution but with no luck.
UPDATE
Media query works only on desktop on resize. When I resize the window to a smaller size and I reload the page, this shows the canvas until I resize the window again. I then realised that the issue is due to the fact that I show the canvas on load through javascript
window.onload = function() {
InitCanvas();
var canvas = document.getElementById("canvasTop");
$("#canvasTop").onmouseup = handleMouseUp;
$("#canvasTop").onmousedown = handleMouseDown;
$("#canvasTop").onmouseout = handleMouseOut;
$("#canvasTop").onmousemove = handleMouseMove;
}
I'm not sure how to stop this on mobile though.