优化esc退出全屏监听

feat/task1-c-wallet
gongfuxiang 2019-03-02 11:09:08 +08:00
parent 0de02aa25e
commit b47fb76086
1 changed files with 39 additions and 0 deletions

View File

@ -1032,6 +1032,29 @@ function FullscreenExit()
return true;
}
/**
* 全屏ESC监听
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-03-01
* @desc description
*/
var fullscreen_counter = 0;
function FullscreenEscEvent()
{
fullscreen_counter++;
if(fullscreen_counter%2 == 0)
{
var $fullscreen = $('.fullscreen-event');
if(($fullscreen.attr('data-status') || 0) == 1)
{
$fullscreen.find('.fullscreen-text').text($fullscreen.data('fulltext-open') || '开启全屏');
$fullscreen.attr('data-status', 0);
}
}
}
// 公共数据操作
$(function()
@ -1053,7 +1076,23 @@ $(function()
}
}
$(this).attr('data-status', status == 0 ? 1 : 0);
$(this).attr('data-status-y', status);
});
// esc退出全屏事件
document.addEventListener("fullscreenchange", function(e) {
FullscreenEscEvent();
});
document.addEventListener("mozfullscreenchange", function(e) {
FullscreenEscEvent();
});
document.addEventListener("webkitfullscreenchange", function(e) {
FullscreenEscEvent();
});
document.addEventListener("msfullscreenchange", function(e) {
FullscreenEscEvent();
});
// 多选插件初始化
if($('.chosen-select').length > 0)