You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.0 KiB
JavaScript

layui.use(["layer", "element"], function () {
var $ = layui.$,
layer = layui.layer,
element = layui.element;
$(".right-fold-box .unfold").on("click", function () {
window.parent.leftMenuChange();
});
});
//显示 tips <span data-tips="编辑" onmouseover="showToolTips(this)"></span>
function showToolTips(t) {
var row = layui.$(t).attr("data-tips");
layer.tips(row, t, { tips: 1, time: 2000 });
}
//假如 500px px2rem(500) 3.125rem
function px2rem(pxVal) {
return (pxVal * 0.8375) / 134 + 'rem';
}
//暴力关闭所有弹窗
function cancelDialog() {
layer.closeAll();
}
//rem resize 改变的是iframe 中页面的html font-size
!function (win, doc) {
var d = doc.documentElement;
//300为左侧宽度
function change() {
d.style.fontSize = (d.clientWidth + 300) / 10 + 'px';
}
win.addEventListener('resize', change, false);
change();
}(window, document);
//部分区域全屏
function partFullScreen(buttonClass, fuuareaId) {
var fullarea = document.getElementById(fuuareaId);
var buttonEle = layui.$('.' + buttonClass);
var fullscreen = parseInt(buttonEle.attr('data-screen'));
if (fullscreen) { // 退出全屏
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
buttonEle.attr('data-screen', '0').html('全屏');
} else { // 进入全屏
if (fullarea.requestFullscreen) {
fullarea.requestFullscreen();
} else if (fullarea.webkitRequestFullScreen) {
fullarea.webkitRequestFullScreen();
} else if (fullarea.mozRequestFullScreen) {
fullarea.mozRequestFullScreen();
} else if (fullarea.msRequestFullscreen) {
fullarea.msRequestFullscreen();
} else {
console.log('不支持全屏');
}
buttonEle.attr('data-screen', '1').html('退出');
}
}