PDA

View Full Version : Resolved curtain script issue



evan5
06-17-2009, 05:43 AM
1) Script Title:
Left right curtain

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex3/document6.htm

3) Lol does anyone know why this script works only when you do not implement any doc type. I need a doc type for some other things I have on my web page. And this curtain script looks kinda snazzy for my webpage.

Anyone have any clue on how one can go around this?:cool:

Check it out, it does not work if you put any doc type in your document.

jscheuer1
06-18-2009, 04:33 AM
It's an old script, not written for DOCTYPE standards. Give this version a try:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
<!--
.intro{
position:absolute;
left:0;
top:0;
layer-background-color:red;
background-color:red;
border:0.1px solid red;
z-index:9;
}
-->
</style>
</head>
<body>


<div id="i1" class="intro"></div><div id="i2" class="intro"></div>
<script type="text/javascript">

/*
Left-Right Curtain Script- Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more free DHTML scripts, and TOS,
visit http://dynamicdrive.com
*/

var ns4=document.layers?1:0
var ie4=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

var speed=20
var temp=new Array()
var temp2=new Array()
if (ns4){
for (i=1;i<=2;i++){
temp[i]=eval("document.i"+i+".clip")
temp2[i]=eval("document.i"+i)
temp[i].width=window.innerWidth/2
temp[i].height=window.innerHeight
temp2[i].left=(i-1)*temp[i].width
}
}
else if (ie4||ns6){
var clipright=ns6?window.innerWidth/2*0.98:document.body.clientWidth/2,clipleft=0
for (i=1;i<=2;i++){
temp[i]=ns6?document.getElementById("i"+i).style:eval("document.all.i"+i+".style")
temp[i].width=ns6?window.innerWidth/2*0.98 + 'px' : iecompattest().clientWidth/2 + 'px';
temp[i].height=ns6?window.innerHeight-1 + 'px' : iecompattest().offsetHeight + 'px';
temp[i].left=(i-1)*parseInt(temp[i].width) + 'px';
}
}


function openit(){
window.scrollTo(0,0)
if (ns4){
temp[1].right-=speed
temp[2].left+=speed
if (temp[2].left>window.innerWidth/2)
clearInterval(stopit)
}
else if (ie4||ns6){
clipright-=speed
temp[1].clip="rect(0 "+clipright+"px auto 0)"
clipleft+=speed
temp[2].clip="rect(0 auto auto "+clipleft+"px)"
if (clipright<=0){
clearInterval(stopit)
if (ns6){
temp[1].display="none"
temp[2].display="none"
}
}
}
}

function gogo(){
stopit=setInterval("openit()",100)
}
gogo()

</script>
</body>
</html>

evan5
06-18-2009, 06:26 AM
oh ok awsome Js, thanks for that.