| | <!DOCTYPE html> |
| | <html lang="it"> |
| | <head> |
| | <meta charset="UTF-8"> |
| | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| | <title>Sito con Musica di Sottofondo</title> |
| | <script src="https://cdn.tailwindcss.com"></script> |
| | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> |
| | <style> |
| | |
| | @keyframes pulse { |
| | 0% { transform: scale(1); } |
| | 50% { transform: scale(1.1); } |
| | 100% { transform: scale(1); } |
| | } |
| | |
| | .pulse-animation { |
| | animation: pulse 2s infinite; |
| | } |
| | |
| | |
| | input[type="range"] { |
| | -webkit-appearance: none; |
| | height: 6px; |
| | background: #e2e8f0; |
| | border-radius: 5px; |
| | background-image: linear-gradient(#3b82f6, #3b82f6); |
| | background-size: 0% 100%; |
| | background-repeat: no-repeat; |
| | } |
| | |
| | input[type="range"]::-webkit-slider-thumb { |
| | -webkit-appearance: none; |
| | height: 16px; |
| | width: 16px; |
| | border-radius: 50%; |
| | background: #3b82f6; |
| | cursor: pointer; |
| | box-shadow: 0 0 2px 0 #555; |
| | transition: all .3s ease; |
| | } |
| | |
| | input[type="range"]::-webkit-slider-thumb:hover { |
| | transform: scale(1.2); |
| | background: #2563eb; |
| | } |
| | |
| | |
| | .music-player { |
| | transition: all 0.3s ease; |
| | } |
| | |
| | |
| | .volume-container:hover .volume-slider { |
| | opacity: 1; |
| | width: 100px; |
| | } |
| | |
| | .volume-slider { |
| | transition: all 0.3s ease; |
| | width: 0; |
| | opacity: 0; |
| | } |
| | </style> |
| | </head> |
| | <body class="bg-gray-100 min-h-screen flex flex-col"> |
| | |
| | <nav class="bg-white shadow-lg"> |
| | <div class="max-w-6xl mx-auto px-4"> |
| | <div class="flex justify-between items-center py-4"> |
| | <div class="text-2xl font-bold text-blue-600">Il Mio Sito</div> |
| | <div class="hidden md:flex space-x-8"> |
| | <a href="#" class="text-gray-700 hover:text-blue-600">Home</a> |
| | <a href="#" class="text-gray-700 hover:text-blue-600">Servizi</a> |
| | <a href="#" class="text-gray-700 hover:text-blue-600">Contatti</a> |
| | <a href="#" class="text-gray-700 hover:text-blue-600">Chi Siamo</a> |
| | </div> |
| | <div class="md:hidden"> |
| | <button class="text-gray-700 focus:outline-none"> |
| | <i class="fas fa-bars text-xl"></i> |
| | </button> |
| | </div> |
| | </div> |
| | </div> |
| | </nav> |
| |
|
| | |
| | <main class="flex-grow container mx-auto px-4 py-8"> |
| | <h1 class="text-4xl font-bold text-center text-gray-800 mb-8">Benvenuto nel mio sito</h1> |
| | |
| | <div class="bg-white rounded-lg shadow-md p-6 max-w-3xl mx-auto"> |
| | <p class="text-gray-700 mb-4">Questo è un esempio di sito con musica di sottofondo. Il player musicale è posizionato in basso a destra e rimane fisso mentre navighi nel sito.</p> |
| | <p class="text-gray-700 mb-4">Puoi mettere in pausa la musica, regolare il volume o cambiare tracce usando i controlli del player.</p> |
| | <p class="text-gray-700">La musica riprenderà automaticamente quando torni su questa pagina, a meno che tu non l'abbia messa in pausa manualmente.</p> |
| | </div> |
| | |
| | <div class="grid md:grid-cols-2 gap-6 mt-8 max-w-4xl mx-auto"> |
| | <div class="bg-white rounded-lg shadow-md p-6"> |
| | <h2 class="text-2xl font-bold text-gray-800 mb-4">Feature 1</h2> |
| | <p class="text-gray-700">Descrizione della prima feature del tuo sito. Puoi aggiungere qualsiasi contenuto qui.</p> |
| | </div> |
| | <div class="bg-white rounded-lg shadow-md p-6"> |
| | <h2 class="text-2xl font-bold text-gray-800 mb-4">Feature 2</h2> |
| | <p class="text-gray-700">Descrizione della seconda feature del tuo sito. Personalizza questo contenuto come preferisci.</p> |
| | </div> |
| | </div> |
| | </main> |
| |
|
| | |
| | <footer class="bg-gray-800 text-white py-6"> |
| | <div class="container mx-auto px-4 text-center"> |
| | <p>© 2023 Il Mio Sito. Tutti i diritti riservati.</p> |
| | </div> |
| | </footer> |
| |
|
| | |
| | <div class="fixed bottom-4 right-4 music-player bg-white rounded-lg shadow-xl p-4 w-72 z-50"> |
| | <div class="flex items-center justify-between mb-3"> |
| | <div class="flex items-center"> |
| | <div class="w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center mr-3"> |
| | <i class="fas fa-music text-blue-600 text-xl"></i> |
| | </div> |
| | <div> |
| | <h3 class="font-semibold text-gray-800" id="song-title">Canzone di Sottofondo</h3> |
| | <p class="text-xs text-gray-500" id="song-artist">Artista Sconosciuto</p> |
| | </div> |
| | </div> |
| | <button id="toggle-player" class="text-gray-500 hover:text-gray-700"> |
| | <i class="fas fa-times"></i> |
| | </button> |
| | </div> |
| | |
| | <div id="player-controls" class="flex flex-col"> |
| | <div class="flex items-center justify-between mb-2"> |
| | <span class="text-xs text-gray-500" id="current-time">0:00</span> |
| | <input type="range" id="progress-bar" class="flex-grow mx-2" value="0"> |
| | <span class="text-xs text-gray-500" id="duration">0:00</span> |
| | </div> |
| | |
| | <div class="flex items-center justify-between"> |
| | <button id="prev-btn" class="text-gray-700 hover:text-blue-600 p-2"> |
| | <i class="fas fa-step-backward"></i> |
| | </button> |
| | <button id="play-btn" class="bg-blue-600 text-white rounded-full w-10 h-10 flex items-center justify-center hover:bg-blue-700 pulse-animation"> |
| | <i class="fas fa-play" id="play-icon"></i> |
| | </button> |
| | <button id="next-btn" class="text-gray-700 hover:text-blue-600 p-2"> |
| | <i class="fas fa-step-forward"></i> |
| | </button> |
| | <div class="volume-container flex items-center ml-2"> |
| | <button id="volume-btn" class="text-gray-700 hover:text-blue-600 p-2"> |
| | <i class="fas fa-volume-up" id="volume-icon"></i> |
| | </button> |
| | <input type="range" id="volume-slider" class="volume-slider ml-1" min="0" max="1" step="0.01" value="0.5"> |
| | </div> |
| | </div> |
| | </div> |
| | </div> |
| |
|
| | |
| | <audio id="audio-player" loop> |
| | |
| | <source src="https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3" type="audio/mpeg"> |
| | Il tuo browser non supporta l'elemento audio. |
| | </audio> |
| |
|
| | <script> |
| | document.addEventListener('DOMContentLoaded', function() { |
| | |
| | const audioPlayer = document.getElementById('audio-player'); |
| | const playBtn = document.getElementById('play-btn'); |
| | const playIcon = document.getElementById('play-icon'); |
| | const prevBtn = document.getElementById('prev-btn'); |
| | const nextBtn = document.getElementById('next-btn'); |
| | const progressBar = document.getElementById('progress-bar'); |
| | const currentTimeEl = document.getElementById('current-time'); |
| | const durationEl = document.getElementById('duration'); |
| | const volumeBtn = document.getElementById('volume-btn'); |
| | const volumeIcon = document.getElementById('volume-icon'); |
| | const volumeSlider = document.getElementById('volume-slider'); |
| | const togglePlayerBtn = document.getElementById('toggle-player'); |
| | const musicPlayer = document.querySelector('.music-player'); |
| | const songTitle = document.getElementById('song-title'); |
| | const songArtist = document.getElementById('song-artist'); |
| | |
| | |
| | const songs = [ |
| | { |
| | title: "Melodia Rilassante", |
| | artist: "Natura Sonora", |
| | src: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3" |
| | }, |
| | { |
| | title: "Armonia Celeste", |
| | artist: "Pace Interiore", |
| | src: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-2.mp3" |
| | }, |
| | { |
| | title: "Sinfonia del Mattino", |
| | artist: "Alba Musicale", |
| | src: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-3.mp3" |
| | } |
| | ]; |
| | |
| | let currentSongIndex = 0; |
| | let isPlaying = false; |
| | let isPlayerVisible = true; |
| | |
| | |
| | function loadSong() { |
| | const song = songs[currentSongIndex]; |
| | songTitle.textContent = song.title; |
| | songArtist.textContent = song.artist; |
| | audioPlayer.src = song.src; |
| | |
| | |
| | if (isPlaying) { |
| | audioPlayer.play().catch(e => console.log("Errore riproduzione automatica:", e)); |
| | } |
| | } |
| | |
| | |
| | function playSong() { |
| | isPlaying = true; |
| | playIcon.classList.replace('fa-play', 'fa-pause'); |
| | playBtn.classList.add('pulse-animation'); |
| | audioPlayer.play().catch(e => console.log("Errore riproduzione automatica:", e)); |
| | } |
| | |
| | |
| | function pauseSong() { |
| | isPlaying = false; |
| | playIcon.classList.replace('fa-pause', 'fa-play'); |
| | playBtn.classList.remove('pulse-animation'); |
| | audioPlayer.pause(); |
| | } |
| | |
| | |
| | function nextSong() { |
| | currentSongIndex = (currentSongIndex + 1) % songs.length; |
| | loadSong(); |
| | if (isPlaying) playSong(); |
| | } |
| | |
| | |
| | function prevSong() { |
| | currentSongIndex = (currentSongIndex - 1 + songs.length) % songs.length; |
| | loadSong(); |
| | if (isPlaying) playSong(); |
| | } |
| | |
| | |
| | function updateProgress() { |
| | const { duration, currentTime } = audioPlayer; |
| | const progressPercent = (currentTime / duration) * 100; |
| | progressBar.style.backgroundSize = `${progressPercent}% 100%`; |
| | progressBar.value = progressPercent; |
| | |
| | |
| | const durationMinutes = Math.floor(duration / 60); |
| | let durationSeconds = Math.floor(duration % 60); |
| | if (durationSeconds < 10) durationSeconds = `0${durationSeconds}`; |
| | |
| | |
| | if (durationSeconds) { |
| | durationEl.textContent = `${durationMinutes}:${durationSeconds}`; |
| | } |
| | |
| | const currentMinutes = Math.floor(currentTime / 60); |
| | let currentSeconds = Math.floor(currentTime % 60); |
| | if (currentSeconds < 10) currentSeconds = `0${currentSeconds}`; |
| | currentTimeEl.textContent = `${currentMinutes}:${currentSeconds}`; |
| | } |
| | |
| | |
| | function setProgress(e) { |
| | const width = this.clientWidth; |
| | const clickX = e.offsetX; |
| | const duration = audioPlayer.duration; |
| | audioPlayer.currentTime = (clickX / width) * duration; |
| | } |
| | |
| | |
| | function setVolume() { |
| | const volume = this.value; |
| | audioPlayer.volume = volume; |
| | |
| | |
| | if (volume == 0) { |
| | volumeIcon.className = 'fas fa-volume-mute'; |
| | } else if (volume < 0.5) { |
| | volumeIcon.className = 'fas fa-volume-down'; |
| | } else { |
| | volumeIcon.className = 'fas fa-volume-up'; |
| | } |
| | } |
| | |
| | |
| | function togglePlayer() { |
| | isPlayerVisible = !isPlayerVisible; |
| | if (isPlayerVisible) { |
| | musicPlayer.classList.remove('hidden'); |
| | togglePlayerBtn.innerHTML = '<i class="fas fa-times"></i>'; |
| | } else { |
| | musicPlayer.classList.add('hidden'); |
| | togglePlayerBtn.innerHTML = '<i class="fas fa-music"></i>'; |
| | |
| | togglePlayerBtn.style.position = 'fixed'; |
| | togglePlayerBtn.style.bottom = '20px'; |
| | togglePlayerBtn.style.right = '20px'; |
| | togglePlayerBtn.style.zIndex = '50'; |
| | togglePlayerBtn.style.backgroundColor = 'white'; |
| | togglePlayerBtn.style.padding = '10px'; |
| | togglePlayerBtn.style.borderRadius = '50%'; |
| | togglePlayerBtn.style.boxShadow = '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)'; |
| | } |
| | } |
| | |
| | |
| | playBtn.addEventListener('click', () => { |
| | isPlaying ? pauseSong() : playSong(); |
| | }); |
| | |
| | prevBtn.addEventListener('click', prevSong); |
| | nextBtn.addEventListener('click', nextSong); |
| | |
| | audioPlayer.addEventListener('timeupdate', updateProgress); |
| | audioPlayer.addEventListener('ended', nextSong); |
| | |
| | progressBar.addEventListener('click', setProgress); |
| | |
| | volumeSlider.addEventListener('input', setVolume); |
| | |
| | togglePlayerBtn.addEventListener('click', togglePlayer); |
| | |
| | |
| | audioPlayer.volume = volumeSlider.value; |
| | |
| | |
| | loadSong(); |
| | |
| | |
| | playSong(); |
| | audioPlayer.play().catch(e => { |
| | console.log("Riproduzione automatica bloccata. L'utente deve interagire prima."); |
| | pauseSong(); |
| | }); |
| | }); |
| | </script> |
| | <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=ecoradio/zz" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> |
| | </html> |