开发者

How can i make my canvas area fit to the iphone browser?

开发者 https://www.devze.com 2023-03-27 22:16 出处:网络
I ve created a game using HTML5. the canvas size is 320x480. When the webpage opens in the browser of an iphone the canvas 开发者_Go百科area will be placed in the left top corner of the browser and un

I ve created a game using HTML5. the canvas size is 320x480. When the webpage opens in the browser of an iphone the canvas 开发者_Go百科area will be placed in the left top corner of the browser and unless i zoom it i cannot play the game. What is that i can do .. please help. Thanks.


You need to set the meta tag for viewport to the size of the iPhone screen.

<meta name="viewport" content="width=device-width; height=device-height; initial-scale=1.0; maximum-scale=1.0;"/>

This will scale the page correctly so that you do not have to zoom in at first, and will prevent the user from scaling after the page has opened.

0

精彩评论

暂无评论...
验证码 换一张
取 消