[Web2.0] Scurire la pagina

Andrea Colanicchia andrea.colanicchia a gmail.com
Mar 19 Dic 2006 18:23:17 CET


On 12/19/06, Marcello Vezzelli <marcello a vezz.it> wrote:
> Su IE6 dà un errore sul resize.

Bug risolto.

Se stiamo parlando dello stesso bug... in pratica se allargavi la
finestra mentre il div era nascosto e poi lo facevi comparire, le
dimensioni erano sbagliate.

Ora prima di far comparire il div, lo ridimensiona alla finestra.

Andrea.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
   <title>BLUR Example</title>
	<script language="javascript">
		nav = (typeof document.all!=="undefined")?"ie":"moz";
		show = false
		
		function doBlur()
		{
			el = document.getElementById('test');
			show = true
			
			resizeBackground()
			el.style.display = 'block';
		}
		
		function doUnblur()
		{
			el = document.getElementById('test');
			show = false

			el.style.display = 'none';
		}
	
		function resizeBackground()
		{
			el = document.getElementById('test');
			
			el.style.width = ((document.documentElement.clientWidth)?
document.documentElement.clientWidth : document.body.clientWidth) +
"px";
			el.style.height = ((document.documentElement.clientHeight)?
document.documentElement.clientHeight : document.body.clientHeight) +
"px";
		}
		
		if (nav == "ie")
		{
			window.onresize = function () { if(show) { resizeBackground(); } }
		}
		else
		{
			window.addEventListener('resize', resizeBackground, false);
		}
	</script>
	<style type="text/css">
		#test {
			position: absolute;
			top: 0px;
			left: 0px;
			width: 100%;
			height: 100%;
			display: none;
			text-align:right;
			background:
			black; filter:alpha(opacity=60);
			-moz-opacity: 0.6;
			opacity: 0.6;
			border-style: none;
			padding: 0;
			margin: 0;
			z-index: 999;
		}
	</style>
</head>
<body id="body" onload="resizeBackground()">

<input type="button" name="click" value="blur" onclick="doBlur();">

<p>
asdas da dadasdasdasdads ads ads<br>
ad asdasd ads ads asd ads asd ads<br>
ads asd adsadsads ads ads asd ads<br>
a sdas<br>
<br>
asdas da dadasdasdasdads ads ads<br>
ad asdasd ads ads asd ads asd ads<br>
ads asd adsadsads ads ads asd ads<br>
a sdas<br>
<br></p>

<div id="test">
   <input type="button" name="unblur" value="close" onclick="doUnblur()">
</div>

</body>


Maggiori informazioni sulla lista Web2.0