Closed Thread Icon

Preserved Topic: setZindex (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=18322" title="Pages that link to Preserved Topic: setZindex (Page 1 of 1)" rel="nofollow" >Preserved Topic: setZindex <span class="small">(Page 1 of 1)</span>\

 
Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 07-17-2002 09:17

Yeah, I know, I use all the mr.maX scripts, but they are excellents!

The original function is this one:

function setZIndex(name, z) {
getObj(name).zIndex = z;
}

It works cool, but I want to make the z-index be higher with the mouse clicks!

Let's say I have 2 layers, and the layerA is over the layerB when clicking a link calls the ZIndex function and layerB goes over layerA.

I want this process be continuous no matter how many click you make, click link 1 layerA goes over and link 2 layerB goes over.

I made this:

var z = 1000;
function setZIndex(name, z) {
var z = (z + 100);
getObj(name).zIndex = z;
}

And the link:
onClick="setZIndex('quien',z);"

but as you can imagine, just work for one click....

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 07-17-2002 09:33

This code should do it (notice that I changed one variable name, and removed "var" inside function):

var z = 1000;
function setZIndex(name, x) {
z = (x + 100);
getObj(name).zIndex = z;
}



Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 07-17-2002 09:55

As usual it worked, thanx mr.maX!!!

Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 07-20-2002 21:12

=) me. again.

Let's explain al from the begining:

I have the mr.maX script to make layers transparents:

code:
function maxSetOpacity() {
if (isIE) { arguments[0].filters.alpha.opacity = arguments[1]; } else
if (isMozilla) { arguments[0].style.MozOpacity = arguments[1]+"%"; }
}

var z = 1000;
function setZIndex(name, x) {
z = (x + 100);
getObj(name).zIndex = z;
}

function restore(name, z) {
getObj(name).zIndex = z;
}



Then I use <a href="javascript:maxSetOpacity(document.getElementById('cosas'), 100);" onClick="setZIndex('cosas',z);">link</a> to bring the layer and <a href="javascript:maxSetOpacity(document.getElementById('quien'), 25);" onClick="restore('quien',10);">link</a> to send it back

I know it does not work with Netscape, but I'll make a script in PHP to detect and blah blah blah....

What I was trying to do now, is to make a link to send them all back!!!!!
I was trying to define the layers into the function, but I think that I'll have to make another function, the problem is that I have no idea on how to affect anly those layers in the function when is called.

An array? do you have any reference or idea?

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 07-20-2002 21:46

var layers = new Array(
'layer1',
'layer2',
'layer3' // <- no comma at the last entry
);

function restoreAll() {
&nbsp;&nbsp;&nbsp;&nbsp;for (i=0; i < layers.length; i++) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxSetOpacity(document.getElementById(layers[i]), 25);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;restore(layers[i], 10);
&nbsp;&nbsp;&nbsp;&nbsp;}
}

Enjoy!


Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 07-21-2002 07:53
quote:
Enjoy



I will, hehehe

Thanks mr.maX, you're every day making my life easier!

« BackwardsOnwards »

Show Forum Drop Down Menu