From 7b1bd3b0812cbdf6398b38b9aaa922af11d49932 Mon Sep 17 00:00:00 2001 From: JunkJumper Date: Wed, 19 Feb 2020 16:14:31 +0100 Subject: [PATCH] LE TAQUIN FONCTIONNE !!!! --- TD3/js/td3-exo1.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/TD3/js/td3-exo1.js b/TD3/js/td3-exo1.js index f1ab6f1..1e74a61 100644 --- a/TD3/js/td3-exo1.js +++ b/TD3/js/td3-exo1.js @@ -16,11 +16,14 @@ function selection(event) { var maCase = event.currentTarget; var vide = document.body.querySelector(".case.vide"); - if ((maCase.offsetTop == vide.offsetTop && Math.abs(maCase.offsetLeft - vide.offsetLeft == 102)) || - (maCase.offsetLeft == vide.offsetLeft && Math.abs(maCase.offsetTop - vide.offsetTop == 102))) { - console.log("1"); + if ((maCase.offsetTop == vide.offsetTop && Math.abs(maCase.offsetLeft - vide.offsetLeft) == 102) || + (maCase.offsetLeft == vide.offsetLeft && Math.abs(maCase.offsetTop - vide.offsetTop) == 102)) { + console.log("ok"); maCase.className = "case vide"; + var buff = maCase.innerHTML; + maCase.innerHTML = ""; vide.className = "case"; + vide.innerHTML = buff; } console.log(event.currentTarget.className + " : " + event.currentTarget.innerText);