-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
25 lines (21 loc) · 845 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
document.addEventListener('DOMContentLoaded', function () {
const socialLinks = document.querySelectorAll('#social a');
socialLinks.forEach(link => {
link.setAttribute('target', '_blank');
});
});
// Function to increment the visitor count
function incrementCounter() {
// Retrieve current count from localStorage
let count = localStorage.getItem('visitorCount');
// Convert count to number (or initialize as 0 if null)
count = parseInt(count) || 0;
// Increment count
count++;
// Update localStorage with new count
localStorage.setItem('visitorCount', count);
// Update counter display
document.getElementById('counter').textContent = count;
}
// When the page loads, increment the counter
window.addEventListener('load', incrementCounter);