W3C home > Mailing lists > Public > public-html-ig-zh@w3.org > August 2011

Re: fullscreen mode 全屏

From: Ben Luo <benluo@gmail.com>
Date: Sat, 6 Aug 2011 16:53:25 +0800
Message-ID: <CAETyRJCgxUOOYc7+EzTOb9PPr-n8smL1QSAJOVYtR8kftWBomA@mail.gmail.com>
To: John Hax <johnhax@gmail.com>
Cc: Zi Bin Cheah <zibin@opera.com>, 中文HTML5同樂會ML 中文HTML興趣小組 <public-html-ig-zh@w3.org>
这个效果很好。和 oo.o 的效果没什么大区别了。

2011/8/6 John Hax <johnhax@gmail.com>

> 这个API很有用。
>
> 这里顺便发一下我的fullscreen的兼容脚本(window.fullScreen属性和fullscreenchange事件)。
>
> if (!('fullScreen' in window)) Object.defineProperty(window, 'fullScreen',
> {
>  get: function() {
> return (screen.width == window.outerWidth && screen.height ==
> window.outerHeight)
>  }
> })
> var _fullScreen = window.fullScreen
>  if (!('onfullscreenchange' in window)) window.addEventListener('resize',
> function() {
> var f = window.fullScreen
>  if (f != _fullScreen) {
> _fullScreen = f
> fireSimpleEvent('fullscreenchange', document, {bubbles:true})
>  }
> }, false)
>
> function fireSimpleEvent(type, target, option) {
>  if (!target) target = document
> if (!option) option = {}
> var evt = document.createEvent('Event')
>  evt.initEvent(type, !!option.bubbles, !!option.cancelable)
> return target.dispatchEvent(evt)
>  }
>
> fullscreen应用实例:我自己的演讲slides都是用HTML5的,在全屏时进入slides状态。例子见:
> http://hax.github.com/2011/es5_safety/ ,Chrome/FF中按F11可以看到效果。
>
>
> 2011/8/5 Zi Bin Cheah <zibin@opera.com>
>
>> 全屏对HTML5 apps发展应该是很重要的,**apps如果没法控制全屏就没有办法达到native的效果,**
>> 比方html5游戏还是给人网页的感觉,而非一个game。
>>
>> Mozilla提出了Fullscreen API[1],webkit也会使用它[2]。
>>
>> 比方调用video全屏
>>
>> <video src="pelican.webm" autoplay
>>       onclick="event.target.**requestFullScreen()"
>>       onended="document.**cancelFullScreen()">
>> </video>
>>
>> 最大的隐忧是全屏是否应该得到用户的允许下才能进行(**explicit permission),而且也存在这其他安全问题。
>>
>>
>> [1]https://wiki.mozilla.org/**Gecko:FullScreenAPI<https://wiki.mozilla.org/Gecko:FullScreenAPI>
>> [2]http://lists.whatwg.org/**htdig.cgi/whatwg-whatwg.org/**
>> 2011-May/031538.html<http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-May/031538.html>
>>
>>
>>
>>
>
Received on Saturday, 6 August 2011 08:54:12 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:43:49 UTC