Forum Moderators: open
Does anyone know if it is possible to change elements of a class such as the z-index number via an onclick command.
Basically I have a drag script with multiple objects, the idea is that when someone clicks on and drags an item it should be on the top most layer.
As it stands I have a system whereby I am simply switching the className back and forth each. One with a zindex of 2 and one with a zindex of 1.
Only problem is that when you have more than 2 elements to drag each requiring the top position when selected (WITHOUT modifying the order of the others) it becomes a little more complex.
Basically it would be ideal if there was some way of editing the class zindex to always be highest by perhaps looking for the highest zindex and adding 1 or something.....
Kind regards
Walker
var topZIndex = 20;
Then assign an increneted value every time within the onclick part of the drag script:
elmRef.style.zIndex = topZIndex++;
This will be OK until Javascript runs out of precise integers.
(The World would have ended some millennia beforehand)