Arrcttacsrks commited on
Commit
2687d9e
·
verified ·
1 Parent(s): 58456a4

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +22 -1
index.html CHANGED
@@ -98,10 +98,12 @@
98
  </h1>
99
  </div>
100
 
101
- <div id="spider" class="spider">😘❤️</div>
 
102
 
103
  <script>
104
  const spider = document.getElementById('spider');
 
105
  let mouseX = window.innerWidth / 2;
106
  let mouseY = window.innerHeight / 2;
107
  let spiderX = mouseX, spiderY = mouseY;
@@ -128,6 +130,25 @@
128
  spiderY = e.clientY;
129
  });
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  function moveSpider() {
132
  const dx = mouseX - spiderX;
133
  const dy = mouseY - spiderY;
 
98
  </h1>
99
  </div>
100
 
101
+ <div id="spider" class="spider">🕷️❤️</div>
102
+ <audio id="bg-music" src="music.mp3" autoplay loop hidden></audio>
103
 
104
  <script>
105
  const spider = document.getElementById('spider');
106
+ const music = document.getElementById('bg-music');
107
  let mouseX = window.innerWidth / 2;
108
  let mouseY = window.innerHeight / 2;
109
  let spiderX = mouseX, spiderY = mouseY;
 
130
  spiderY = e.clientY;
131
  });
132
 
133
+ document.addEventListener('touchmove', (e) => {
134
+ const touch = e.touches[0];
135
+ mouseX = touch.clientX;
136
+ mouseY = touch.clientY;
137
+ createHeart(mouseX, mouseY);
138
+ });
139
+
140
+ document.addEventListener('touchstart', (e) => {
141
+ const touch = e.touches[0];
142
+ createHeart(touch.clientX, touch.clientY);
143
+ spiderX = touch.clientX;
144
+ spiderY = touch.clientY;
145
+ });
146
+
147
+ // Bypass autoplay block
148
+ document.addEventListener('click', () => {
149
+ music.play();
150
+ }, { once: true });
151
+
152
  function moveSpider() {
153
  const dx = mouseX - spiderX;
154
  const dy = mouseY - spiderY;