老是不通過,沒辦法,只能是重新發布了,反正我就是槓上了,大大小小寫過很多前端特效,當然也經常在網上copy或者修改人家的程式碼,我覺得也挺好的,為什麼?!因為我想這樣,你能怎麼辦,打我?
少廢話,直接上程式碼,
JS程式碼
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程式碼
最近受了一點點小刺激,對自己做的工作產生迷茫,不知道還要做這個做多久,還有我其實還是喜歡設計多一些,還有我喜歡設計,但是設計太難了,經常覺得自己做的東西跟別人的,比起來差個好幾萬塊錢,Why?你問我,我問誰。好吧,我也很無賴。
舉個小小例子,隨便來一個按鈕試試,按鈕上在來個點選事件切換。
<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>
記得一定要加上呼叫程式碼,呼叫程式碼,呼叫程式碼,說三遍...
JS呼叫程式碼
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");
};
只做個人備忘,不做任何發表,不做資訊交流。
儘管拿去用,不謝!