Chrome退出全屏问题
function requestFullScreen(element)
{
if (element.requestFullscreen)
element.requestFullscreen();
else if (element.msRequestFullscreen)
element.msRequestFullscreen();
else if (element.mozRequestFullScreen)
element.mozRequestFullScreen();
else if (element.webkitRequestFullscreen)
element.webkitRequestFullscreen();
} function cancelFullScreen()
{
if (document.exitFullscreen)
document.exitFullscreen();
else if (document.msExitFullscreen)
document.msExitFullscreen();
else if (document.mozCancelFullScreen)
document.mozCancelFullScreen();
else if (document.webkitExitFullscreen)
document.webkitExitFullscreen();
}
function isFullScreen()
{
return (document.fullScreenElement && document.fullScreenElement !== null)
|| document.mozFullScreen
|| document.webkitIsFullScreen;
} function toggleFullScreen(element)
{
if (isFullScreen())
cancelFullScreen();
else
requestFullScreen(element || document.documentElement);
}


function toggleFullScreen(element)
{
requestFullScreen(element || document.documentElement);
cancelFullScreen();
}
完整代码参考:
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="../js/jquery-1.10.1.min.js"></script>
<script>
function isFullScreen()
{
return (document.fullScreenElement && document.fullScreenElement !== null)
|| document.mozFullScreen
|| document.webkitIsFullScreen;
} function requestFullScreen(element)
{
if (element.requestFullscreen)
element.requestFullscreen();
else if (element.msRequestFullscreen)
element.msRequestFullscreen();
else if (element.mozRequestFullScreen)
element.mozRequestFullScreen();
else if (element.webkitRequestFullscreen)
element.webkitRequestFullscreen();
} function cancelFullScreen()
{
if (document.exitFullscreen)
document.exitFullscreen();
else if (document.msExitFullscreen)
document.msExitFullscreen();
else if (document.mozCancelFullScreen)
document.mozCancelFullScreen();
else if (document.webkitExitFullscreen)
document.webkitExitFullscreen();
} function toggleFullScreen(element)
{
requestFullScreen(element || document.documentElement);
cancelFullScreen();
} $(document).ready(function(){
$("#exit").click(function(){
toggleFullScreen(document.body);
});
});
</script>
</head>
<body>
<div style="padding-top:300px;"></div>
<button id="exit">退出</button>
</body>
</html>
Chrome退出全屏问题的更多相关文章
- js 实现操作浏览器或者元素的全屏与退出全屏功能
<!DOCTYPE html> <html lang="en" id="div1"> <head> <meta cha ...
- js控制全屏及退出全屏
js控制全屏及退出全屏,网上很多代码例子,我这里需求和标准的有点出入: 1.当用户点击某按钮,触发iframe下的页面全屏. 2.不允许用户退出全屏. 解决第一点,触发全屏可以按照网上的例子,代码如下 ...
- HTML5实现全屏API【进入和退出全屏】
现在主流浏览器基本上实现了全屏效果,但是不同浏览器实现不一样: [进入和退出全屏] // Webkit (works in Safari5.1 and Chrome 15)element.webkit ...
- JS控制全屏,监听退出全屏事件
实现方案 //进入全屏 function requestFullScreen(de) { if(de.requestFullscreen){ //W3C de.requestFullscreen(); ...
- js之切换全屏和退出全屏实现
应用场景:比如很多网页游戏全屏之类的,或者是网上看小说等. 核心代码: //控制全屏 function enterfullscreen() { //进入全屏 $("#fullscreen&q ...
- HTML5--浏览器全屏操作、退出全屏、是否全屏
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- iOS 多个播放器同时播放,双击全屏,单击退出全屏
前言:公司需求如下:点击一个按钮播放一个视频,最多同时播放4个:双击某视频让其全屏,单击再恢复原来的样子.IOS的播放器有两种,MPMoviePlayerController,AVAudioPlaye ...
- [delphi]极域学生端解除键盘鼠标锁定退出全屏广播-强制窗口化-源代码
v2.0 2015-07-11 更新了V2.0 版本 发布在吾爱破解论坛 欢迎下载使用 http://www.52pojie.cn/thread-382769-1-1.html ---------- ...
- js控制页面的全屏展示和退出全屏显示
<!DOCTYPE html> <html> <meta http-equiv="Content-Type" content="text/h ...
随机推荐
- Xcode插件筛选
Xcode高效插件推荐 好像很多iOS开发的同学都不知道Xcode有插件这么一说,所以整理了一下自己用的Xcode高效插件,分享给大家 下列插件在Xcode 7.0.1 版本做测试通过可以使用 在Xc ...
- Bzoj 1687: [Usaco2005 Open]Navigating the City 城市交通 广搜,深搜
1687: [Usaco2005 Open]Navigating the City 城市交通 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 122 So ...
- map/reduce实现数据去重
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.co ...
- opencv Installation in Linux and hello world
http://opencv.org/quickstart.html Installation in Linux These steps have been tested for Ubuntu 10.0 ...
- 【Java重构系列】重构31式之封装集合
2009年,Sean Chambers在其博客中发表了31 Days of Refactoring: Useful refactoring techniques you have to know系列文 ...
- cocos2d-x 关于opengl version too old 问题解决办法
转载请注明出处 http://blog.csdn.net/u010229677/article/details/9704961 今天cocos2d-x突然出现这个对话框,去国外论坛找的解决办法.折腾许 ...
- C#Stimulator项目>>>C/C++ DLL的生成和调用,Windows下的多线程
Windows下的多线程 http://blog.csdn.net/ganpengjin1/article/category/2541791 使用C/C++建立DLL,环境VS2013 新建Win32 ...
- 实时的.NET程序错误监控产品Exceptionless开源了
博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:实时的.NET程序错误监控产品Exceptionless开源了.
- C++访问sqlite3实践
Sqlite确实是一个比较好的本地数据库,从接触它的时候就喜欢上了它,它可以在很多情况下简化应用.不过以前都是在Java里面使用,或者Linux C下使用的,现在有个项目(C++)可能我会用到sqli ...
- Python介绍、环境搭建(Eclipse插件)、第一个程序
Python介绍 特点 优雅.明白.简单. 适合领域 1. Web站点和各种网络服务 2. 系统工具和脚本 3. 作为"胶水"语言把其它语言开发的模块包装起来方便使用 和其它语言对 ...