Jump to content

Hide Canvas


Recommended Posts

Another beginner Q I'm afraid.


I'd like to be able to show some standard HTML to get some info from the user. Then hide the HTML (using jQuery), and show a task based on the Phaser canvas/system for sometime, then hide the Phaser canvas again and show some other HTML stuff. I'm ok with all the HTML jQuery stuff.




1) what's the best/easiest way of hiding/showing the phaser canvas until it's needed (I'm not placing the Phaser canvas in a div because I can't get vertical centering to work properly when I do that).


2) is it possible to create new.game with the canvas already hidden?


3) can/should the phaser updating etc be turned off whilst the canvas is hidden


thanks again, d.

Link to comment
Share on other sites

Thanks, yes I thought CSS would work but doesn't seem to (see minimal test code below).


<!doctype html>

    <meta charset="UTF-8" />
    <script src="phaser.min.js"></script>
    <style type="text/css">
    canvas {
        display: none;

    <script type="text/javascript">
    var game = new Phaser.Game(800, 600, Phaser.AUTO, '');


Link to comment
Share on other sites

Well that got rid the canvas, but I don't seem to be able to get it to become un-hidden now (ie display block rather than none). I think the !important tag overrides everything even later changes to the style?

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...