-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2614 from Anjaliavv51/main
Visitors counts increaments move it to the left end corner of webpage
- Loading branch information
Showing
4 changed files
with
85 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
.visitor-counter { | ||
position: fixed; | ||
top: 570px; | ||
left: 10px; | ||
background-color: transparent; | ||
height: 100px; | ||
width: 100px; | ||
color: black; | ||
font-weight: 700; | ||
font-size: 18px; | ||
text-align: center; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
border-radius: 200px; | ||
backdrop-filter: blur(5px); | ||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), | ||
0 1px 3px rgba(0, 0, 0, 0.08); | ||
z-index: 1000; | ||
} | ||
|
||
.visitor-counter div:first-child { | ||
margin-bottom: 5px; | ||
} | ||
|
||
.website-counter { | ||
font-size: 24px; | ||
} | ||
|
||
@media screen and (max-width: 768px) { | ||
.visitor-counter { | ||
height: 100px; | ||
width: 100px; | ||
font-size: 16px; | ||
} | ||
|
||
.website-counter { | ||
font-size: 20px; | ||
} | ||
} | ||
|
||
@media screen and (max-width: 480px) { | ||
.visitor-counter { | ||
height: 80px; | ||
width: 80px; | ||
font-size: 14px; | ||
} | ||
|
||
.website-counter { | ||
font-size: 18px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters