Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
3869 Widoki

Hi,

How can i add button on screen in website? I will use for when you scroll down, this button will stay always left-bottom and it will work for go to the top of page. Is there any way to do that with builder, or i should write my own js and html?

Thanks..

Awatar
Odrzuć
Najlepsza odpowiedź

Hii

Go to your Website
Click Edit → Drag in an HTML block

Paste this code inside:

<a href="#" id="goToTopBtn" style="

  position: fixed;

  bottom: 20px;

  left: 20px;

  z-index: 999;

  background-color: #0e6efd;

  color: white;

  padding: 10px 14px;

  border-radius: 50px;

  font-size: 16px;

  text-align: center;

  text-decoration: none;

  display: none;">

  ↑ Top

</a>


<script>

window.addEventListener('scroll', function () {

  const btn = document.getElementById('goToTopBtn');

  btn.style.display = window.scrollY > 300 ? 'block' : 'none';

});

document.getElementById('goToTopBtn').addEventListener('click', function (e) {

  e.preventDefault();

  window.scrollTo({ top: 0, behavior: 'smooth' });

});

</script>

i hope it is use full

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
paź 24
1965
4
maj 25
2316
2
sty 25
2103
4
sty 25
4173
0
lis 24
1511