figol18

Рейтинг
15
Регистрация
26.02.2012

Ребята помогите пожалуйста. Нужно что бы при нажатии на кнопку флэш swf растягивалась на весь экран. Сейчас скрипт работает но swf не растягивается.

<!DOCTYPE html>

<html>

<head>

<title>msExitFullscreen API test</title>

</head>

<body>

<div id="fs-container">

<div id="fs_section" style="width: 800px; height: 600px;">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="100%">

<param name="movie" value="D:/Games/3djetski.swf" />

<param name="quality" value="high" />

<embed src="D:/Games/3djetski.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="100%"></embed> </object>

</div>

<button onclick="enterFullscreen('fs_section')">Toggle iframe content fullscreen</button>

</div>

<style>

:-webkit-full-screen{

background: black;

}

:-moz-full-screen {

background: black;

}

:-webkit-full-screen#fs_section_video.fs_section,

:-webkit-full-screen#fs_section_img.fs_section{

width:100%;

left:0;

top:0;

}

:-moz-full-screen#fs_section_video.fs_section,

:-moz-full-screen#fs_section_img.fs_section{

width:100%;

left:0;

}

:-webkit-full-screen#fs_section_img.fs_section #i1{

display:none;

}

:-moz-full-screen#fs_section_img.fs_section #i1{

display:none;

}

:-webkit-full-screen#fs_section_img.fs_section #i2{

display:block;

z-index:1;

}

:-moz-full-screen#fs_section_img.fs_section #i2{

display:block;

z-index:1;

}

:-webkit-full-screen#fs_section_img.fs_section #i3{

opacity:1;

display:block;

z-index:2;

-webkit-transition: all 2s 2s ease-in-out;

}

:-moz-full-screen#fs_section_img.fs_section #i3{

opacity:1;

display:block;

z-index:2;

-moz-transition: all 2s 2s ease-in-out;

}

</style>

<script type="text/javascript">

document.cancelFullScreen = document.cancelFullScreen || document.webkitCancelFullScreen || document.mozCancelFullScreen;

function onFullScreenEnter() {

console.log("Enter fullscreen initiated from iframe");

};

function onFullScreenExit() {

console.log("Exit fullscreen initiated from iframe");

};

// Note: FF nightly needs about:config full-screen-api.enabled set to true.

function enterFullscreen(id) {

onFullScreenEnter(id);

var el = document.getElementById(id);

var onfullscreenchange = function(e){

var fullscreenElement = document.fullscreenElement || document.mozFullscreenElement || document.webkitFullscreenElement;

var fullscreenEnabled = document.fullscreenEnabled || document.mozFullscreenEnabled || document.webkitFullscreenEnabled;

console.log( 'fullscreenEnabled = ' + fullscreenEnabled, ', fullscreenElement = ', fullscreenElement, ', e = ', e);

}

el.addEventListener("webkitfullscreenchange", onfullscreenchange);

el.addEventListener("mozfullscreenchange", onfullscreenchange);

el.addEventListener("fullscreenchange", onfullscreenchange);

if (el.webkitRequestFullScreen) {

el.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);

} else {

el.mozRequestFullScreen();

}

document.querySelector('#'+id + ' button').onclick = function(){

exitFullscreen(id);

}

}

function exitFullscreen(id) {

onFullScreenExit(id);

document.cancelFullScreen();

document.querySelector('#'+id + ' button').onclick = function(){

enterFullscreen(id);

}

}

</script>

</body>

</html>