Browse Source

instant play

am
Amirul Anwar 4 months ago
parent
commit
b3b13f9dcc
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      resources/views/digital-card.blade.php

+ 4
- 1
resources/views/digital-card.blade.php View File

37
                 var scrollAmount = window.innerHeight / 7; // Amount to scroll per interval
37
                 var scrollAmount = window.innerHeight / 7; // Amount to scroll per interval
38
     
38
     
39
                 function playAudio() {
39
                 function playAudio() {
40
-                    if (!hasPlayed && scrollCount >= maxScrolls) {
40
+                    if (!hasPlayed) {
41
+                        console.log('play')
41
                         var playPromise = audioElement.play();
42
                         var playPromise = audioElement.play();
42
     
43
     
43
                         if (playPromise !== undefined) {
44
                         if (playPromise !== undefined) {
54
     
55
     
55
                 function smoothScroll() {
56
                 function smoothScroll() {
56
                     if (!hasPlayed) {
57
                     if (!hasPlayed) {
58
+                        playAudio();
57
                         scrollCount++;
59
                         scrollCount++;
58
                         if (scrollCount >= maxScrolls) {
60
                         if (scrollCount >= maxScrolls) {
59
                             playAudio();
61
                             playAudio();
66
 
68
 
67
                 function playOnly() {
69
                 function playOnly() {
68
                     if (!hasPlayed) {
70
                     if (!hasPlayed) {
71
+                        playAudio();
69
                         scrollCount++;
72
                         scrollCount++;
70
                         if (scrollCount >= maxScrolls) {
73
                         if (scrollCount >= maxScrolls) {
71
                             playAudio();
74
                             playAudio();

Loading…
Cancel
Save