Results 1 to 3 of 3

Thread: curtain script issue

  1. #1
    Join Date
    Oct 2008
    Posts
    48
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default curtain script issue

    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?

    Check it out, it does not work if you put any doc type in your document.
    Last edited by Snookerman; 06-18-2009 at 11:47 AM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    It's an old script, not written for DOCTYPE standards. Give this version a try:

    Code:
    <!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>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    evan5 (06-18-2009)

  4. #3
    Join Date
    Oct 2008
    Posts
    48
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    oh ok awsome Js, thanks for that.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •