...

View Full Version : loading layers off of the available screen view...how



BrightNail
07-14-2003, 09:38 AM
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.

Mr J
07-14-2003, 08:06 PM
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>

BrightNail
07-16-2003, 08:42 PM
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

Mr J
07-16-2003, 08:52 PM
Yes.

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

BrightNail
07-29-2003, 12:04 AM
cancelled my post



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum