|
热门文章 |
|
|
|
相关文章 |
|
没有相关文章 |
|
|
实用的Flash全屏和退出全屏切换效果 |
来源:畅无忧设计 更新时间:2011/10/22 21:21:24 阅读次数: 我要投稿 |
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>实用的Flash全屏和退出全屏切换效果</title> <meta http-equiv="content-type" content="text/html;charset=gb2312"> <!--把下面代码加到<head>与</head>之间--> <style type="text/css"> body{margin:0px;} </style> </head> <body> 预览效果时左下角会提示错误,而且看不到效果,刷新一下就可以看到效果了;当然,在实际使用中,不会出现这样的问题。<br> <!--把下面代码加到<body>与</body>之间--> <div id="flashcontent" style="width:400px;height:300px;"></div> <script language="javascript" src="http://www.cwydesign.com/effects/UploadFiles_7074/201110/2011102221225002.js"></script> <script language="JavaScript"> var orginFlash = {init:false,isFullScreen:false,position:"",top:"",left:"",width:"",height:""}; function writeFlash(){ var so = new SWFObject("http://www.cwydesign.com/effects/UploadFiles_7074/201110/2011102221234166.swf", "fplayer", "100%", "100%", 8, "#FFFFFF"); so.addParam("quality", "high"); so.addParam("swLiveConnect", "true"); so.addParam("menu", "false"); so.addParam("allowScriptAccess", "sameDomain"); so.addParam("allowFullScreen", "true"); so.write("flashcontent"); } function getScreenSize(){ var w = 0; var h = 0; if( typeof( window.innerWidth ) == 'number' ) { w = window.innerWidth; h = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { w = document.documentElement.clientWidth; h = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { w = document.body.clientWidth; h = document.body.clientHeight; } return {width:w,height:h}; } function fullScreen(){ if(!orginFlash.init){ orginFlash.position = document.getElementById("flashcontent").style.position; orginFlash.top = document.getElementById("flashcontent").style.top; orginFlash.left = document.getElementById("flashcontent").style.left; orginFlash.width = document.getElementById("flashcontent").style.width; orginFlash.height = document.getElementById("flashcontent").style.height; } orginFlash.init = true; orginFlash.isFullScreen = true; var screenSize = getScreenSize(); try{ document.getElementById("flashcontent").style.position = "absolute"; document.getElementById("flashcontent").style.top = "0px"; document.getElementById("flashcontent").style.left = "0px"; document.getElementById("flashcontent").style.width = screenSize.width +"px"; document.getElementById("flashcontent").style.height = screenSize.height +"px"; document.body.style.overflow="hidden"; window.scrollTo(0,0); }catch(e){ } } function normal(){ if(orginFlash.init){ orginFlash.isFullScreen = false; try{ document.getElementById("flashcontent").style.position = orginFlash.position; document.getElementById("flashcontent").style.top = orginFlash.top; document.getElementById("flashcontent").style.left = orginFlash.left; document.getElementById("flashcontent").style.width = orginFlash.width; document.getElementById("flashcontent").style.height = orginFlash.height; document.body.style.overflow="auto"; }catch(e){ } } } function reSize(){ if(orginFlash.isFullScreen){ fullScreen(); } } window.onresize = reSize; writeFlash(); </script> </body> </html> |
特效说明: |
实用的Flash全屏和退出全屏切换效果 |
|
上一篇文章: 纯CSS实现三列DIV等高布局下一篇文章: 一个不错的CSS分页样式 |
|
|