EmtaWiki: erinevus redaktsioonide vahel

Allikas: EmtaWiki
Resümee puudub
Resümee puudub
Märgis: Tühistatud
196. rida: 196. rida:
  [[#top| Back to the Top ]]
  [[#top| Back to the Top ]]
</div>
</div>
<script>
    // Get the button
    const backToTopButton = document.getElementById("BackToTop");
    // Listen for scroll events
    window.onscroll = function() {
        toggleBackToTopButton();
    };
    function toggleBackToTopButton() {
        // Show the button after scrolling down 100px from the top
        if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
            backToTopButton.style.display = "block";
        } else {
            backToTopButton.style.display = "none";
        }
    }
    // Smooth scroll to top on button click
    backToTopButton.onclick = function() {
        window.scrollTo({ top: 0, behavior: 'smooth' });
    };
</script>

Redaktsioon: 7. november 2024, kell 10:50



<script>

   // Get the button
   const backToTopButton = document.getElementById("BackToTop");
   // Listen for scroll events
   window.onscroll = function() {
       toggleBackToTopButton();
   };
   function toggleBackToTopButton() {
       // Show the button after scrolling down 100px from the top
       if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
           backToTopButton.style.display = "block";
       } else {
           backToTopButton.style.display = "none";
       }
   }
   // Smooth scroll to top on button click
   backToTopButton.onclick = function() {
       window.scrollTo({ top: 0, behavior: 'smooth' });
   };

</script>