<title>Barra Gialla Fissa</title> <style> .yellow-bar { background-color: red; height: 5px; width: 10px; position: fixed; top: 0; left: 0; z-index: 999; } .content { margin-top: 50px; padding: 50px; } </style> <script> window.onscroll = function() {scrollFunction()}; function scrollFunction() { document.querySelector('.yellow-bar').style.width = ((window.pageYOffset / (document.body.scrollHeight - window.innerHeight)) * 100) + '%'; } </script> </head> <body> <div class="yellow-bar"></div> <div class="content"> <h1>Titolo della Pagina</h1> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut enim ad minim veniam.<br><br><br><br><br></p> </div> |