+ 3
Stacking up stuff
Is it possible to make the new div appears on top of the old ones? https://code.sololearn.com/WgoX6fDm66TO/?ref=app
8 Answers
+ 2
Maybe this is what you are looking to do.
[edit]
Hatsy Rei good lookin out ; ) I guess i missed that. Maybe this?
https://code.sololearn.com/WW4EVeZuU3MO/?ref=app
+ 5
Adding
position:absolute;
to the div style would make them all stack up. :>
+ 4
xp nvdo That looks like the output of the first reply I provided. I think what OP wants is to have new divs appear there (which is what you have achieved), but old divs move downwards, giving way to the new div, e.g.
A <- div A
....
B <- new div B
A <- div A now at bottom
...
C <- new div C
B <- old div B
A <- oldest div A
It is certainly achievable by storing and manipulating the position of each div within the container, but I need some time to sit down and get a code working.
+ 3
xp nvdo Looking good indeed. ;>
+ 3
Thank you xp nvdo !
So the magic word is .unshift()
Nice to learn new cool stuff, yo :)
+ 2
That's very cool, thank you, but not what I'm trying to accomplish.
Imagine SoloLearn activity feed. When a new activity comes in, the old ones move downwards to make room for the new one. That's what I mean by stacking up. Is that even posible with the divs?
+ 1
Thank you, but adding position:absolute; to the div style makes the new div covers the old ones.
+ 1
Fernando Moceces I thought that was exactly what you meant by having divs on top of each other. If you want to show them a little but still stack them, specify increasing values of top/left.
https://code.sololearn.com/WF5f8upaSHeF/?ref=app