Changing div layer

Giganews Newsgroups
Subject: Changing div layer
Posted by:  Andrew Poulos (ap_pr…
Date: Sun, 14 Jun 2020

Say I have a number (tens) of DIV elements. Each has a size and a
position but no nominated z-index. There are on screen buttons which
correspondingly show/hide each DIV.

If all the DIVs start off hidden is there a way to make the last
revealed DIV the top most?

Ideally I'd like stack order of the other revealed DIVs not to change.
So with these hidden DIVS

A B C D E F G H I...

if C is revealed then D is, as the only visible DIV, the highest
then if A is revealed, A becomes the highest
and then if H is revealed, E becomes the highest but A will still be
higher than D.

I guess it's a bit like shuffling a deck of cards, in that pulling a
card from the deck and putting it on top doesn't change the relative
order of the other cards.

Andrew Poulos