From 6770ad949efe78fb99cc20e74d3abc6e076cbeca Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Thu, 21 Sep 2017 02:42:09 -0400 Subject: [PATCH] Move pile shuffle from click listener to interact.js tap event --- script.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/script.js b/script.js index c4c16d9..3909f57 100644 --- a/script.js +++ b/script.js @@ -15,12 +15,6 @@ window.addEventListener('load', () => { deckName = document.querySelector('#card-container').getAttribute("data-deckName"); xhr.open("GET", "/deck/" + deckName + "/deck.json"); xhr.send(); - - document.querySelectorAll('.card-pile').forEach(e => { - e.addEventListener('click', event => { - shuffle(piles[event.target.getAttribute('data-pile')]); - }); - }); }); let cardInteract = interact('.card', {ignoreFrom: '.in-list'}) @@ -127,7 +121,8 @@ interact('.card-pile') cardList.appendChild(newCard); }); showModal(cardList); - }); + }) + .on('tap', event => shuffle(piles[event.target.getAttribute('data-pile')])); function makeCard(cardNum) { // draw a new card