By not always, no way, can only be re-released, anyway, I was on the bar, large and small, has written many front-end special effects, of course, often on the Internet copy or modify other people's code, I think it is quite good, and why ? ! Because I want to do, how can you do, hit me?
Shut up directly on the code,
the JS Code
function fullScreen(el) {
var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen,
wscript;
if(typeof rfs != "undefined" && rfs) {
rfs.call(el);
return;
}
if(typeof window.ActiveXObject != "undefined") {
wscript = new ActiveXObject("WScript.Shell");
if(wscript) {
wscript.SendKeys("{F11}");
}
}
}
function exitFullScreen(el) {
var el= document,
cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.mozCancelFullScreen || el.exitFullScreen,
wscript;
if (typeof cfs != "undefined" && cfs) {
cfs.call(el);
return;
}
if (typeof window.ActiveXObject != "undefined") {
wscript = new ActiveXObject("WScript.Shell");
if (wscript != null) {
wscript.SendKeys("{F11}");
}
}
}
HTML code
recently suffered a little small stimulation, resulting in confusion for their own work, I do not know how long do we need to do this, and in fact, I still like the design a little more, and I like the design, but the design is too difficult, often feel that they do things with others, a difference compared to the tens of thousands of dollars, Why? you ask me, I ask. Well, I am also very rogue.
For a small example, a button just to try to switch to a button click event.
<html id="Content">
<body>
<ul>
<li>
<a id="BtnFullOpen" href="javascript:void(0);" title="按“F11”进入全屏模式">
<i class="ace-icon fa fa-arrows-alt"></i>全屏查看
</a>
<a id="BtnFullQuite" href="javascript:void(0);" title="按“F11”关闭全屏模式" style="display:none;">
<i class="ace-icon fa fa-arrows-alt"></i>全屏关闭
</a>
</li>
<li>2</li>
<li>3</li>
<li>5</li>
</ul>
</body>
</html>
Remember to add the calling code, the calling code, the calling code, say three times ...
JS calling code
var oBtnFullOpen = document.getElementById('BtnFullOpen');
var oContent = document.getElementById('Content');
oBtnFullOpen.onclick = function() {
fullScreen(oContent);
oBtnFullQuite.setAttribute("style", "display:block");
oBtnFullOpen.setAttribute("style", "display:none");
}
var oBtnFullQuite = document.getElementById('BtnFullQuite');
oBtnFullQuite.onclick = function() {
exitFullScreen(oContent);
oBtnFullQuite.setAttribute("style", "display:none");
oBtnFullOpen.setAttribute("style", "display:block");
};
Personal notes only, without any publication, not the exchange of information.
Although take it with, do not mention it!