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

✨Add Visitor Counter feature done ! #672

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,18 @@ <h2>Feedback Form</h2>
</form>
</div>
</div>
<br /><br />
<link rel="stylesheet" href="visi.css">
<!-- ############### Footer ############### -->
<div class="visitor-counter">
<div>Visitor</div>
<div class="website-counter"></div>
</div>
<script src="path/to/visitorCounter.js"></script>
Copy link
Owner

@swaraj-das swaraj-das Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • <script src="path/to/visitorCounter.js"></script>
  • <script src="./assets/css/visitors.css"></script>

What is the meaning of these two lines in code? There is not any path.

<script src="./assets/css/visitors.css"></script>

<script src="visi.js"></script>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don’t add separate files named visi.css and visi.js for this feature. Instead, integrate the code directly into style.css and script.js. This approach will help keep the file structure simple and prevent confusion, ensuring that other developers can easily understand and navigate the project.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay 😭😭 I will give new PR wait


<div class="footer-bottom">
<p><a href="PrivacyPolicy/PrivacyPolicy.html">© 2024 GamingTools | All Rights Reserved</a></p>
<p>Developed by <span><a href="https://my-portfolio-git-main-swaraj-das-projects.vercel.app/"
Expand Down
102 changes: 102 additions & 0 deletions visi.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
.visitor-counter {

margin-top: -120px;
margin-left: 730px;
margin-bottom: 20px;
background: linear-gradient(135deg, #8514ee, #00ffffc9, #ff078b);
height: 60px;
width: 70px;
color: #333; /* Darker text for better contrast */
font-weight: 700;
font-size: 18px;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 12px; /* Softer corners */
backdrop-filter: blur(10px); /* Increased blur for a modern touch */
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15), /* Slightly more pronounced shadow */
0 2px 4px rgba(0, 0, 0, 0.1);
z-index: 1000;
transition: all 0.3s ease; /* Smooth transition for hover effect */

}

.visitor-counter:hover {

transform: scale(1.05); /* Slightly enlarge on hover */
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); /* Enhance shadow on hover */

}

.visitor-counter div:first-child {

margin-bottom: 5px;
font-size: 14px; /* Adjusted for clarity */
letter-spacing: 1px; /* Increased spacing for readability */

}

.website-counter {

font-size: 24px;
font-family: 'Arial', sans-serif; /* Consistent font family */

}

@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;

}

}

.dark-mode .visitor-counter div {

color: #f0f0f0; /* Lighter text for dark mode */

}

.dark-mode .visitor-counter .website-counter {

color: #f0f0f0; /* Lighter color for consistency */

}

.dark-mode .visitor-counter {

background-color: rgba(0, 0, 0, 0.7); /* Darker background for dark mode */
box-shadow: 0 6px 12px rgba(255, 255, 255, 0.1),
0 2px 4px rgba(255, 255, 255, 0.05);

}
29 changes: 29 additions & 0 deletions visi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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);
Loading