Reputation: 23
I have a loop that puts img elements next to each other inside a div, however, my loop doesnt work. i get a timeout, but I don't know why.. Is there something obvious I'm missing?
for(var i = 0; i < 3; i++){
var hatch = document.createElement('img');
hatch.src = "img/Sand.png";
hatch.style.width ="1cm";
hatch.style.position = "absolute";
for(var x=0; Math.ceil((cm2px(2.5)-1)/cm2px(1)) < x; x++) {
if (x != 0) {
hatch.style.left = `"${x*cm2px(1)}cm"`;
}
}
Lith.appendChild(hatch);
}
Upvotes: 0
Views: 41