let's avoid pixels for this

This commit is contained in:
2025-02-18 22:06:57 +02:00
parent 63435d356e
commit f69e5e0ed4

View File

@@ -60,8 +60,8 @@
console.log('move'); console.log('move');
btn2.style.display = 'inline-block'; btn2.style.display = 'inline-block';
btn2.style.position = 'absolute'; btn2.style.position = 'absolute';
btn2.style.top = Math.floor(Math.random() * (playzone.clientHeight - btn2.clientHeight)) + 'px'; btn2.style.top = Math.floor((Math.random() * (playzone.clientHeight - btn2.clientHeight))/playzone.clientHeight*100) + '%';
btn2.style.left = Math.floor(Math.random() * (playzone.clientWidth - btn2.clientWidth)) + 'px'; btn2.style.left = Math.floor((Math.random() * (playzone.clientWidth - btn2.clientWidth))/playzone.clientWidth*100) + '%';
} }
}); });