Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts

    loading layers off of the available screen view...how

    Hey everyone..

    first off, let me say that I totally appreciate all the help I get here.

    I am building some functionality for a particular app, and the fact that i load all my layers on a page in the same spot but hidden is make the transition between the layers (hiding/showing) a little slow.

    What I do is just pass in the layer name and then HIDE the stored div layer, and SHOW the passed one (into the function)..since I position the layers where I want them...its fine..Now, what if I want all layers that are hidden..loaded off of the available browser view...then when I need them they show at the appropriate coordinates...

    right now, I just have an easy function

    showObject(n){
    if stored(
    stored.hidden;
    stored = n;
    )
    n.visible;
    }

    somethign like that..I don't remember exaclty what i put ('im not at work)...

    so, what is the cleanest way to load layers off of the screen and then when I want to show/hide them...I pass in the 'name of the div layer', x and y coordinates....since in some instances, they need to be slightly different...

    please advise.

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Have a play with the following


    <SCRIPT language=javascript>
    <!--
    last=""
    function showdiv(id,x,y){

    document.getElementById(id).style.left=x
    document.getElementById(id).style.top=y
    if(last!=""){
    document.getElementById(last).style.left= -100
    document.getElementById(last).style.top= 0
    }
    last=id
    }
    -->
    </SCRIPT>

    <div id="div1" style="position:absolute;left:-100px;top:0px;width:100px;height:100px;background-color:blue">DIV 1</div>
    <div id="div2" style="position:absolute;left:-100px;top:0px;width:100px;height:100px;background-color:red">DIV 2</div>
    <div id="div3" style="position:absolute;left:-100px;top:0px;width:100px;height:100px;background-color:red">DIV 3</div>
    <a href="#null" onclick="showdiv('div1',100,100)">Show 1</a><BR>
    <a href="#null" onclick="showdiv('div2',200,200)">Show 2</a><BR>
    <a href="#null" onclick="showdiv('div3',300,300)">Show 3</a><BR>

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts
    cool,
    I'll give it a try.....

    just curious on the 'show' and 'hide' feature..

    are we actually getting rid of the show/hide feature and just placing thing appropriately?

    -B

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Yes.

    If you are going to reposition the layer "offscreen" then there is no reason to "hide" the layer

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts
    cancelled my post
    Last edited by BrightNail; 07-29-2003 at 12:35 AM.


  •  

    Posting Permissions

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