Browse Source

增加记忆翻牌提示

master
jiannibang 6 years ago
parent
commit
b2b29a635a
  1. 11
      h5/flipper/flipper.css
  2. 8
      h5/flipper/game.js
  3. BIN
      h5/flipper/tip.png

11
h5/flipper/flipper.css

@ -10,6 +10,17 @@
grid-gap: 1.25%; grid-gap: 1.25%;
padding: 26.48148148148148% 16.34259259259259% 0 16.34259259259259%; padding: 26.48148148148148% 16.34259259259259% 0 16.34259259259259%;
} }
.flipper .tip {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
background: center / 65.83333333333333% no-repeat url("./tip.png"),
rgba(0, 0, 0, 0.6);
z-index: 1;
}
.flipper .meta { .flipper .meta {
position: absolute; position: absolute;
top: 16.6%; top: 16.6%;

8
h5/flipper/game.js

@ -23,6 +23,14 @@ export default class Game {
this.init(); this.init();
} }
init() { init() {
const tip = document.createElement("div");
tip.className = "tip";
this.cardsContainer.appendChild(tip);
tip.addEventListener("click", (e) => {
e.stopPropagation();
e.preventDefault();
this.cardsContainer.removeChild(tip);
});
Object.assign(this, { Object.assign(this, {
steps: 40, steps: 40,
score: 0, score: 0,

BIN
h5/flipper/tip.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Loading…
Cancel
Save