Well, you could try this (probably very expensive) operation and see if it works for you:

var max_z = 0;
$$('div').each(function(elm){
        var z = elm.getStyle('z-index');
        max_z = (z <= max_z) ? max_z : z;
});

If you can scope your $$ to a smaller universe, or use $ ('foo').select('div') instead, you might be able to shave some cycles off of that. Another approach would be to do this once at page load, then each time you add a new "top" element, increment the max_z global variable to match. You just want to keep building higher, there's no reason to worry about decrementing when you remove the top element.

Walter

On Jul 3, 2011, at 12:58 PM, kstubs wrote:

Any tips on managing zindex for a given page where many absolute positioned objects occur? Further, one object may expand and require a greater zindex of the object nearby, and of course the same is true of every object on the page. This is not as easy as managing a bunch of known objects, these objects don't actually know the other exist. I'm wondering if there is an optimal way to discover what the max zindex is on the page, and go from there.

Anyhow, any ideas would be great.

Karl..

--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/z1S97SMUSZkJ . To post to this group, send email to prototype-scriptaculous@googlegroups.com . To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en .

--
You received this message because you are subscribed to the Google Groups "Prototype 
& script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to