Skip to content

Commit

Permalink
Visitors Count Added AdityaSinha2305#65
Browse files Browse the repository at this point in the history
  • Loading branch information
yamini1183 committed Oct 26, 2024
1 parent 2a70cac commit 9a2ccb1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
</nav>
<img src="assets/img1.jpg" class="bg" alt="Background Image" />
<div class="container-fluid">
<div id="visitor-count" class="visitor-count">
<p>Total Visits: <span id="count">0</span></p>
</div>
<!-- Toggle Captcha Menu -->
<div class="toggleMenu">
<button class="toggleCaptchaBtn" id="textCaptchaBtn">Text</button>
Expand Down
14 changes: 14 additions & 0 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ const readMathBtn = document.querySelector("#readMath");
const submitMathBtn = document.querySelector("#submitMathBtn");
const changeMathBtn = document.querySelector("#changeMathBtn");

function updateVisitorCount() {
const countElement = document.getElementById('count');
let visitCount = localStorage.getItem('visitCount');

if (visitCount) {
visitCount = parseInt(visitCount) + 1;
localStorage.setItem('visitCount', visitCount);
} else {
visitCount = 1;
localStorage.setItem('visitCount', visitCount);
}
countElement.textContent = visitCount;
}
document.addEventListener("DOMContentLoaded", updateVisitorCount);

let captchaType = "text";

Expand Down
19 changes: 19 additions & 0 deletions styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,25 @@ body {
z-index: -1;
/* Places the image behind all other content */
}

.visitor-count {
background: linear-gradient(45deg, #4CAF50, #2196F3);
color: #fff;
text-align: center;
padding: 10px;
border-radius: 10px;
font-size: 1.2rem;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
margin: 20px auto;
width: 200px;
transition: transform 0.3s;
}

.visitor-count:hover {
transform: scale(1.05);
}


.captcha-container
{
/* min-width: 50%; */
Expand Down

0 comments on commit 9a2ccb1

Please sign in to comment.