XF 2.3 Custom Javascript in notice

Codeless

Active member
hi i want to add this javascript code in notice only
no idea where to palce tried via adding custom js templete but not works tried to add in page_container but it will take over on whole site

JavaScript:
<script>
    document.addEventListener("DOMContentLoaded", function () {
        const matrix = document.getElementById("matrix");
        const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*";

        if (matrix) {
            for (let i = 0; i < 50; i++) {
                const column = document.createElement("div");
                column.className = "matrix-column";
                column.style.left = `${i * 20}px`;
                column.style.animationDuration = `${Math.random() * 2 + 1}s`;

                let content = "";
                for (let j = 0; j < 50; j++) {
                    content += characters[Math.floor(Math.random() * characters.length)] + "<br>";
                }
                column.innerHTML = content;
                matrix.appendChild(column);
            }
        }
    });
</script>
 
Back
Top Bottom