Skip to content

Commit bec4d70

Browse files
authored
Merge pull request #1596 from Peart-Guy/main
Added a Visitor Counter
2 parents 1ce6852 + 8cc72ef commit bec4d70

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

Website/index.html

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,118 @@ <h2>Here are some of our active GitHub repositories</h2>
587587

588588
<!-- new footer changes -->
589589
<div class="footer">
590+
591+
592+
<!-- visitor counter -->
593+
<div class="visitor-counter">
594+
<div>Visitor</div>
595+
<div class="website-counter"></div>
596+
</div>
597+
<style>
598+
.visitor-counter {
599+
position: fixed;
600+
top: 570px;
601+
left: 10px;
602+
background-color: rgba(255, 255, 255, 0.8); /* Slightly opaque background for better visibility */
603+
height: 100px;
604+
width: 100px;
605+
color: #333; /* Darker text for better contrast */
606+
font-weight: 700;
607+
font-size: 18px;
608+
text-align: center;
609+
display: flex;
610+
flex-direction: column;
611+
justify-content: center;
612+
align-items: center;
613+
border-radius: 12px; /* Softer corners */
614+
backdrop-filter: blur(10px); /* Increased blur for a modern touch */
615+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15), /* Slightly more pronounced shadow */
616+
0 2px 4px rgba(0, 0, 0, 0.1);
617+
z-index: 9999999999999;
618+
transition: all 0.3s ease; /* Smooth transition for hover effect */
619+
}
620+
621+
.visitor-counter:hover {
622+
transform: scale(1.05); /* Slightly enlarge on hover */
623+
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); /* Enhance shadow on hover */
624+
}
625+
626+
.visitor-counter div:first-child {
627+
margin-bottom: 5px;
628+
font-size: 14px; /* Adjusted for clarity */
629+
letter-spacing: 1px; /* Increased spacing for readability */
630+
}
631+
632+
.website-counter {
633+
font-size: 24px;
634+
font-family: 'Arial', sans-serif; /* Consistent font family */
635+
}
636+
637+
@media screen and (max-width: 768px) {
638+
.visitor-counter {
639+
height: 100px;
640+
width: 100px;
641+
font-size: 16px;
642+
}
643+
644+
.website-counter {
645+
font-size: 20px;
646+
}
647+
}
648+
649+
@media screen and (max-width: 480px) {
650+
.visitor-counter {
651+
height: 80px;
652+
width: 80px;
653+
font-size: 14px;
654+
}
655+
656+
.website-counter {
657+
font-size: 18px;
658+
}
659+
}
660+
661+
.dark-mode .visitor-counter div {
662+
color: #f0f0f0; /* Lighter text for dark mode */
663+
}
664+
665+
.dark-mode .visitor-counter .website-counter {
666+
color: #f0f0f0; /* Lighter color for consistency */
667+
}
668+
669+
.dark-mode .visitor-counter {
670+
background-color: rgba(0, 0, 0, 0.7); /* Darker background for dark mode */
671+
box-shadow: 0 6px 12px rgba(255, 255, 255, 0.1),
672+
0 2px 4px rgba(255, 255, 255, 0.05);
673+
}
674+
675+
</style>
676+
<script>
677+
// Function to get the count from localStorage or initialize it
678+
function getVisitorCount() {
679+
return localStorage.getItem('visitorCount') || 0;
680+
}
681+
682+
// Function to increment and save the count
683+
function incrementVisitorCount() {
684+
let count = parseInt(getVisitorCount()) + 1;
685+
localStorage.setItem('visitorCount', count);
686+
return count;
687+
}
688+
689+
// Function to display the count
690+
function displayVisitorCount() {
691+
const counterElement = document.querySelector('.website-counter');
692+
const count = incrementVisitorCount();
693+
counterElement.textContent = count;
694+
}
695+
696+
// Call the display function when the page loads
697+
document.addEventListener('DOMContentLoaded', displayVisitorCount);
698+
</script>
699+
700+
701+
590702
<div class="footer-col">
591703
<img src="./assets/recode-hive.png" alt="">
592704
<p class="footer-p">

0 commit comments

Comments
 (0)