Skip to content

Commit

Permalink
Fix error after fast clicking on cards while turning
Browse files Browse the repository at this point in the history
  • Loading branch information
BeroBurny committed Mar 8, 2018
1 parent 355cfd8 commit d32dfc1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ document.addEventListener("DOMContentLoaded", function() {

let cardMap = {
map: [[]],
turning: false,

startTime: false,
finishTime: false,
Expand Down Expand Up @@ -265,7 +266,8 @@ function starsLogic() {
}

function clickCard(element) {
if (cardMap.secondCard && element.target.id != "game" && element.target.className != "card-space") {
if (cardMap.secondCard && element.target.id != "game" && element.target.className != "card-space" && !cardMap.turning) {
cardMap.turning = true;
let elem, cartNum, cardName;
if (element.target.parentElement.className != "card") {
elem = element.target.parentElement.parentElement;
Expand Down

0 comments on commit d32dfc1

Please sign in to comment.