templates/AppTemplates/layout/topTop.html.twig line 1

Open in your IDE?
  1. <style>
  2. #backToTopBtn {
  3.   display: none;
  4.   position: fixed;
  5.   bottom: 70px;
  6.   right: 0%;
  7.   width: 40px;
  8.   height: 40px;
  9.   font-size: 24px;
  10.   background-color: #fca311;
  11.   color: #14213d;
  12.   border: none;
  13.   cursor: pointer;
  14.   opacity:0;
  15.   transition: opacity 0.3s ease-in-out;
  16.   animation:1s;
  17.   display:flex;
  18.   justify-content:center;
  19.   align-items:center;
  20.   z-index:100030;
  21. }
  22. #backToTopBtn i {
  23.   font-size:16px;
  24.   color:white;
  25. }
  26. .showBtn {
  27.   opacity: 1!important;
  28. }
  29. </style>
  30. <button onclick="scrollToTop()" id="backToTopBtn" title="Retour en haut" data-aos="fade-left">
  31.   <i class="fas fa-long-arrow-alt-up"></i>
  32. </button>
  33. <script>
  34.     function scrollToTop() {
  35.     window.scrollTo({
  36.         top: 0,
  37.         behavior: "smooth"
  38.     });
  39.     }
  40.     window.addEventListener("scroll", function() {
  41.     // button back to top
  42.     var button = document.getElementById("backToTopBtn");
  43.     // div share
  44.     var share  = document.querySelector('.share');
  45.     // var i de H avec la classe special
  46.     var ispeci = document.querySelector('.eNavigation');
  47.     // function
  48.     if (window.scrollY > 300) {
  49.         button.classList.add('showBtn');
  50.         share.classList.add('showBtn')
  51.     } else {
  52.         button.classList.remove('showBtn');
  53.         share.classList.remove('showBtn');
  54.     }
  55.     // function
  56.     if (window.scrollY > 550) {
  57.     } else {
  58.     }
  59. });
  60. </script>