diff options
author | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2023-11-12 22:39:39 +0100 |
---|---|---|
committer | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2023-11-12 22:39:39 +0100 |
commit | 6226c3f330eb7b29440d782966d433c5265ec45e (patch) | |
tree | bf7447b22347b89bd8103319f45cc73debe89256 | |
parent | ea0afca358e69a6092ef072994e3cf4ceb3316b9 (diff) | |
download | votes-for-women-6226c3f330eb7b29440d782966d433c5265ec45e.tar.gz |
fix click events for touch devices
-rw-r--r-- | play.js | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -305,11 +305,12 @@ function create(t, p, ...c) { } function create_campaigner(color, i) { - return create("div", { + let e = create("div", { className: `piece ${color}`, my_campaigner: i, - onmousedown: on_click_campaigner }) + e.addEventListener("click", on_click_campaigner) + return e } function build_user_interface() { @@ -322,21 +323,21 @@ function build_user_interface() { if (r) REGIONS_LAYOUT.push(LAYOUT[r]) } - ui.congress_box.onmousedown = on_click_congress + ui.congress_box.addEventListener("click", on_click_congress) for (let c = 1; c <= 6; ++c) { elt = ui.congress[c] = create("div", { className: "piece congress", style: `left:${10 + (c-1) * 42}px;top:5px;`, - onmousedown: on_click_congress }) + elt.addEventListener("click", on_click_congress) } for (let c = 1; c <= card_count; ++c) { elt = ui.cards[c] = create("div", { className: `card card_${c}`, my_card: c, - onmousedown: on_click_card }) + elt.addEventListener("click", on_click_card) } for (let r = 1; r <= region_count; ++r) { |