dynamic z-index
parent
a7324b15c6
commit
6bb7f87a68
@ -1,16 +1,16 @@
|
|||||||
const container = document.getElementById("container");
|
const container = document.getElementById("container");
|
||||||
// console.log(container.children);
|
// console.log(container.children);
|
||||||
|
|
||||||
let images = Array.from(container.children);
|
let contents = Array.from(container.children);
|
||||||
// console.log(images);
|
// console.log(images);
|
||||||
|
|
||||||
// for (index in images) {
|
contents.forEach((item) => {
|
||||||
// console.log(images[index]);
|
console.log(item);
|
||||||
// }
|
|
||||||
|
|
||||||
images.forEach((image) => {
|
|
||||||
left = Math.random() * 100;
|
left = Math.random() * 100;
|
||||||
top = Math.random() * 100;
|
top = Math.random() * 100;
|
||||||
image.style.left = left + "%";
|
zIndex = Math.round(Math.random() * 1000);
|
||||||
image.style.top = top + "%";
|
|
||||||
|
item.style.left = left + "%";
|
||||||
|
item.style.top = top + "%";
|
||||||
|
item.style.zIndex = zIndex;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue