Explorar el Código

qrcode scanner test

Mike hace 3 años
padre
commit
d6e79c3fd2
Se han modificado 1 ficheros con 12 adiciones y 20 borrados
  1. 12 20
      ArkCard-web/collect.html

+ 12 - 20
ArkCard-web/collect.html

@@ -19,7 +19,9 @@
     <link rel="stylesheet" href="./style.css">
 </head>
 
-<body>    
+<div id="qr-reader" class="hide" style="width:100%;"></div>
+
+<body>
     <section id="sec01" class="sec01-collect container-fluid px-0 mx-0">
         <img class="img-fluid" src="./img/banner.png" alt="">
         <div style="position: relative;" class="card-img-overlay p-0 d-flex align-items-end">
@@ -344,22 +346,7 @@
                 </div>
             </div>
         </div>
-    </form>
-
-    <div id="qrcode-modal" class="modal" tabindex="-1">
-        <div class="modal-dialog">
-          <div class="modal-content">
-            <div class="modal-header">
-              <h5 class="modal-title">請掃描QRCode</h5>
-              <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
-            </div>
-            <div class="modal-body">
-                <div id="qr-reader" style="width:100%;"></div>
-            </div>
-          </div>
-        </div>
-    </div>
-  
+    </form>  
 
     <footer style="background: #484848;" class="py-4 w-100 px-0 mx-0">
         <p class="text-white text-center mb-0">Copyright 2021 版權所有 © Ark.Cards</p>
@@ -383,9 +370,14 @@
 
 <script>
 $(".qrcode").click(function () {
-    $('#qrcode-modal').show();
-    
-    qrcode_scanner();
+    $('#qr-reader').toggle();
+
+    if($("p").is(":visible")){
+        alert("The QRCode Scanner is visible.");
+        qrcode_scanner();
+    } else {
+        alert("The QRCode Scanner is hidden.");
+    }
 });
 
 // 啟動QRCode Scanner