Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the visitor Counter #789

Merged
merged 1 commit into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,35 @@ <h1>Contact Us</h1>
</ul>
</div>

<div class="visitor-counter">
<span class="icon">👁️</span> <!-- You can replace this with an eye icon image if you prefer -->
<span id="visitorCount">Visitors Count:</span>
<span class="website-counter">0</span>
</div>
<script>
// Function to get the count from localStorage or initialize it
function getVisitorCount() {
return localStorage.getItem('visitorCount') || 0;
}

// Function to increment and save the count
function incrementVisitorCount() {
let count = parseInt(getVisitorCount()) + 1;
localStorage.setItem('visitorCount', count);
return count;
}

// Function to display the count
function displayVisitorCount() {
const counterElement = document.querySelector('.website-counter');
const count = incrementVisitorCount();
counterElement.textContent = count;
}

// Call the display function when the page loads
document.addEventListener('DOMContentLoaded', displayVisitorCount);
</script>

<div class=" footer-section quick-links ">
<h1>Quick Links</h1>
<ul class="footer-list">
Expand Down
26 changes: 25 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,30 @@ html {
background-color: #14171a;
}


.visitor-counter {
position: absolute;
background-color: #000000;
color: rgb(255, 255, 255);
top: 3618px;
padding: 10px 20px;
border-radius: 19px;
display: inline-flex;
align-items: center;
font-family: Arial, sans-serif;
margin-left: 0px;
z-index: 10; /* Ensure it stays on top of the border */
}

.visitor-counter .icon {
margin-right: 10px;
}






.quick-links .footer-list a {
position: relative;
}
Expand Down Expand Up @@ -1318,7 +1342,7 @@ input {
width: 200px;

height: 270px;
=======

height: 290px;
transition: 1s;
}
Expand Down