Reputation: 33
How can I apply the HTML5 full screen api to the body tag of a site by clicking a button and then a toggle button to return to browser screen?
I have been playing around but havent got very far.
thanks
Upvotes: 3
Views: 2106
Reputation: 23544
I found that it's better to make the <html>
element full screen, rather than the <body>
, otherwise you lose the scroll bars.
<button onclick="document.documentElement.webkitRequestFullScreen()">Full screen</button>
Obviously you'll want to test for support and use mozRequestFullScreen()
on Firefox.
Upvotes: 5