Pashtetuum commited on
Commit
5f1e061
·
verified ·
1 Parent(s): 0b620ce

Update Главная.html

Browse files
Files changed (1) hide show
  1. Главная.html +41 -1
Главная.html CHANGED
@@ -16,7 +16,47 @@
16
 
17
 
18
 
19
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  <script type="application/ld+json">{
21
  "@context": "http://schema.org",
22
  "@type": "Organization",
 
16
 
17
 
18
 
19
+ <style>
20
+ /* Стили для кнопки */
21
+ #scrollBtn {
22
+ display: none;
23
+ position: fixed;
24
+ bottom: 20px;
25
+ right: 20px;
26
+ z-index: 99;
27
+ border: none;
28
+ outline: none;
29
+ background-color: #333;
30
+ color: white;
31
+ cursor: pointer;
32
+ padding: 15px;
33
+ border-radius: 10px;
34
+ }
35
+ </style>
36
+ </head>
37
+ <body>
38
+
39
+ <!-- Сама кнопка -->
40
+ <button id="scrollBtn" title="Прокрутить к началу страницы">Наверх</button>
41
+ <script>
42
+ // Показываем или скрываем кнопку при прокрутке страницы
43
+ window.onscroll = function() {scrollFunction()};
44
+
45
+ function scrollFunction() {
46
+ if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
47
+ document.getElementById("scrollBtn").style.display = "block";
48
+ } else {
49
+ document.getElementById("scrollBtn").style.display = "none";
50
+ }
51
+ }
52
+
53
+ // Прокручиваем страницу к началу при клике на кнопку
54
+ document.getElementById("scrollBtn").onclick = function() {
55
+ document.body.scrollTop = 0; // Для поддержки старых браузеров
56
+ document.documentElement.scrollTop = 0; // Для современных браузеров
57
+ }
58
+ </script>
59
+
60
  <script type="application/ld+json">{
61
  "@context": "http://schema.org",
62
  "@type": "Organization",