위버

게시판 view페이지에 qr코드 추가하기

· 2025-01-11 (토) 10:46:22 · 3749 · 6

view.skin.php 제일 아래에 아래 코드 추가하시면됩니다.

 

[code]

<script>
    $(document).ready(function () {
        $("head").append('<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.js">');
        $("#bo_v_con").prepend('<div id="qr-code-view"></div>');
        setTimeout(function() {
            var qrcode = new QRCode(document.getElementById("qr-code-view"), {
                text: window.location.href,
                width: 100,
                height: 100,
                colorDark : "#000",
                colorLight : "#fff",
                correctLevel :1
            });
        }, 100);
    })
</script>

[/code]

|

댓글 6개

추천합니다.

2025-01-12 (일) 02:52:00

추천합니다. 멋진팁입니다

그렇게요 바로 bo_v_con 요소로인해서 바로 QR이생성이되는군요 감사합니다.^^ 그러면 기존 view.sns.skin.php 플러그인에서 sns를 호출을 하고있는데 이것을 적용시켜줄려면 어떻게해야 할까요 ;;

css 추가 버전 AI.. 
e1b31101c921cfd6ef11b7be507cef84_1736756068_561.png

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>QR 코드 생성기</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
        }
        #container {
            background-color: white;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
            text-align: center;
        }
        input {
            padding: 10px;
            margin: 10px 0;
            width: 80%;
            max-width: 300px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        button {
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            background-color: #007bff;
            color: white;
            font-size: 16px;
            cursor: pointer;
        }
        button:hover {
            background-color: #0056b3;
        }
        #qr-code-view {
            margin-top: 20px;
        }
    </style>
    <div id="container">
        <label for="user-input">홈페이지 주소 입력:</label>
        <input type="text" id="user-input" placeholder="Enter text here">
        <button onclick="generateQRCode()">QR 코드 생성</button>
        <div id="qr-code-view"></div>
    </div>

    <script>
        function generateQRCode() {
            var inputText = document.getElementById("user-input").value;
            if (inputText) {
                document.getElementById("qr-code-view").innerHTML = "";
                var qrcode = new QRCode(document.getElementById("qr-code-view"), {
                    text: inputText,
                    width: 150,
                    height: 150,
                    colorDark: "#000",
                    colorLight: "#fff",
                    correctLevel: QRCode.CorrectLevel.H
                });
            } else {
                alert("Please enter a value to generate the QR code.");
            }
        }
    </script>
</body>
</html>

감사합니다

멋지네요 최곱니다.

댓글을 작성하시려면 로그인이 필요합니다.

그누보드5 팁자료실

2,788건
+
제목 글쓴이 날짜 조회
25-02-20 조회 3,389
25-02-20 조회 3,715
25-02-19 조회 3,380
25-02-14 조회 3,332
25-02-10 조회 3,847
25-02-08 조회 3,227
25-02-07 조회 3,866
25-02-03 조회 3,353
25-02-02 조회 3,154
25-02-02 조회 3,229
25-02-01 조회 3,367
25-01-29 조회 3,275
25-01-29 조회 3,011
25-01-29 조회 3,063
25-01-23 조회 3,298
25-01-20 조회 3,300
25-01-19 조회 3,289
25-01-17 조회 3,761
25-01-16 조회 3,341
25-01-14 조회 3,718
25-01-14 조회 3,335
25-01-14 조회 3,027
25-01-13 조회 3,271
25-01-11 조회 3,750
25-01-07 조회 4,160
25-01-06 조회 3,311
25-01-04 조회 3,600
25-01-02 조회 3,308
24-12-31 조회 3,536
24-12-30 조회 3,458