web: landing page vanilla HTML/CSS/JS avec ambiance sous-marine
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
32
web/js/main.js
Normal file
32
web/js/main.js
Normal file
@@ -0,0 +1,32 @@
|
||||
// DauphinCraft — main.js (vanilla, no deps)
|
||||
|
||||
// Intersection Observer — fade-in sections
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => entries.forEach(e => {
|
||||
if (e.isIntersecting) { e.target.classList.add('visible'); observer.unobserve(e.target); }
|
||||
}),
|
||||
{ threshold: 0.12 }
|
||||
);
|
||||
document.querySelectorAll('.fade-in').forEach(el => observer.observe(el));
|
||||
|
||||
// Copy server IP to clipboard
|
||||
function copyServerIP() {
|
||||
const ip = document.getElementById('server-ip').textContent;
|
||||
const btn = document.getElementById('btn-copy');
|
||||
if (!navigator.clipboard) { return; }
|
||||
navigator.clipboard.writeText(ip).then(() => {
|
||||
btn.classList.add('copied');
|
||||
btn.querySelector('svg').style.display = 'none';
|
||||
const original = btn.innerHTML;
|
||||
btn.textContent = 'Copié !';
|
||||
setTimeout(() => { btn.innerHTML = original; btn.classList.remove('copied'); }, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
// Close mobile menu when a nav link is clicked
|
||||
document.querySelectorAll('.nav-links a').forEach(a => {
|
||||
a.addEventListener('click', () => {
|
||||
const toggle = document.getElementById('nav-toggle');
|
||||
if (toggle) toggle.checked = false;
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user