Reputation: 297
I create a canvas field using Phaser 3. And this field is added to the end of the body. How can I add it to any div?
Upvotes: 3
Views: 590
Reputation: 1122
You can place the Phaser canvas in a specific <div>
by adding an id
to the <div>
and referencing it as the parent
in your Phaser game configuration.
<div id="gameContainer"></div>
config = {
type: Phaser.CANVAS,
...
parent: 'gameContainer'
};
Upvotes: 3