mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-12-03 20:39:59 +08:00
全屏操作
This commit is contained in:
parent
b4870073bf
commit
75146c1d74
@ -19,9 +19,9 @@
|
||||
|
||||
{{if !IsMobile()}}
|
||||
<li class="am-dropdown am-hide-sm-only">
|
||||
<a href="javascript:;" id="admin-fullscreen" class="tpl-header-list-link">
|
||||
<a href="javascript:;" class="fullscreen-event" data-fulltext-open="开启全屏" data-fulltext-exit="退出全屏">
|
||||
<i class="am-icon-arrows-alt"></i>
|
||||
<span class="admin-fulltext" fulltext-open="开启全屏" fulltext-exit="退出全屏">开启全屏</span>
|
||||
<span class="fullscreen-text">开启全屏</span>
|
||||
</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
@ -51,7 +51,7 @@ input:hover, select:hover, textarea:hover, .chosen-choices:hover, .chosen-single
|
||||
.am-alert-tips, .am-alert-tips * { font-size: 12px; }
|
||||
|
||||
body {margin:0;color:#797979;}
|
||||
html,body {position:relative;background:#fff;height:100%;}
|
||||
html,body {position:relative;background:#fff;height:100%;width:100%;}
|
||||
h1,h2,h3,h4,h5,h6 {font-family:'Karla',sans-serif;margin:10px 0;}
|
||||
h1 {line-height:43px;}
|
||||
h2 {line-height:35px;}
|
||||
|
@ -1,22 +1,5 @@
|
||||
$(function()
|
||||
{
|
||||
/**
|
||||
* 全屏操作
|
||||
*/
|
||||
var $fullscreen = $.AMUI.fullscreen;
|
||||
$('#admin-fullscreen').on('click', function()
|
||||
{
|
||||
$fullscreen.toggle();
|
||||
});
|
||||
if($fullscreen.enabled)
|
||||
{
|
||||
$(document).on($fullscreen.raw.fullscreenchange, function()
|
||||
{
|
||||
$tag = $('.admin-fulltext');
|
||||
$tag.text($fullscreen.isFullscreen ? $tag.attr('fulltext-exit') : $tag.attr('fulltext-open'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* url加载
|
||||
*/
|
||||
|
@ -975,10 +975,86 @@ function ConfirmNetworkAjax(e)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启全屏
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-03-01
|
||||
* @desc description
|
||||
*/
|
||||
function FullscreenOpen()
|
||||
{
|
||||
var elem = document.body;
|
||||
if(elem.webkitRequestFullScreen)
|
||||
{
|
||||
elem.webkitRequestFullScreen();
|
||||
} else if (elem.mozRequestFullScreen)
|
||||
{
|
||||
elem.mozRequestFullScreen();
|
||||
} else if (elem.requestFullScreen)
|
||||
{
|
||||
elem.requestFullScreen();
|
||||
} else {
|
||||
Prompt("浏览器不支持全屏API或已被禁用");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭全屏
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-03-01
|
||||
* @desc description
|
||||
*/
|
||||
function FullscreenExit()
|
||||
{
|
||||
var elem = document;
|
||||
if (elem.webkitCancelFullScreen)
|
||||
{
|
||||
elem.webkitCancelFullScreen();
|
||||
} else if (elem.mozCancelFullScreen)
|
||||
{
|
||||
elem.mozCancelFullScreen();
|
||||
} else if (elem.cancelFullScreen)
|
||||
{
|
||||
elem.cancelFullScreen();
|
||||
} else if (elem.exitFullscreen)
|
||||
{
|
||||
elem.exitFullscreen();
|
||||
} else {
|
||||
Prompt("浏览器不支持全屏API或已被禁用");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// 公共数据操作
|
||||
$(function()
|
||||
{
|
||||
// 全屏操作
|
||||
$('.fullscreen-event').on('click', function()
|
||||
{
|
||||
var status = $(this).attr('data-status') || 0;
|
||||
if(status == 0)
|
||||
{
|
||||
if(FullscreenOpen())
|
||||
{
|
||||
$(this).find('.fullscreen-text').text($(this).data('fulltext-exit') || '退出全屏');
|
||||
}
|
||||
} else {
|
||||
if(FullscreenExit())
|
||||
{
|
||||
$(this).find('.fullscreen-text').text($(this).data('fulltext-open') || '开启全屏');
|
||||
}
|
||||
}
|
||||
$(this).attr('data-status', status == 0 ? 1 : 0);
|
||||
});
|
||||
|
||||
// 多选插件初始化
|
||||
if($('.chosen-select').length > 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user