-
Notifications
You must be signed in to change notification settings - Fork 0
/
js57_2my.html
179 lines (125 loc) · 3.84 KB
/
js57_2my.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<style>
section {
width: 550px;
height: 400px;
margin: 0 auto;
transition: .3s;
/* border: 1px solid blue; */
}
section:hover { filter: brightness(80%);}
div {
position: relative;
width: 70px;
/* border: solid black; */
}
.material-icons {
font-size: 70px;
color: white;
}
#prev { top: -250px; }
#next { top: -330px; left: 475px;}
.material-icons:hover { transition: 1s; color: aqua; }
article {
height: 100px;
background: rgba(143, 188, 143, 0.5);
color: white;
position: relative;
top: -270px;
}
h1, p {
padding-left: 15px;
}
h1 {
padding-top: 10px;
}
a {
text-decoration: none;
}
a:link, a:visited, a:active { color: white;}
a:hover {color: aquamarine;}
h2 {
position: relative;
top: -360px;
left: 15px;
width: fit-content;
border: 1px solid white;
text-align: center;
padding: 0 10px;
}
</style>
</head>
<body>
<section id="sec" onmouseout="timerId = setTimeout(changePic, 2000)">
<a id="h1" href="https://www.belarus.by/ru/about-belarus/geography/minskcity">
<img id="pic" src="images/img1b.jpg" alt=""></a>
<div id="prev"><a href="javascript:bc()"><span class="material-icons">
navigate_before</span></a></div>
<div id="next"><a href="javascript:fr()"><span class="material-icons">
navigate_next</span></a></div>
<article>
<h1 id="t1">Заголовок слайда 1</h1>
<p id="t2"><a href="link1.html">Подзаголовок слайда 1</a></p>
<h2 id="t3"><a href="https://www.belarus.by/ru/about-belarus/geography/minskcity">www.belarus.by</a></h2>
</article>
</section>
<script>
let n=1, p=6;
to = ['https://www.belarus.by/ru/about-belarus/geography/minskcity',
'https://airport.by/','https://regnum.ru/foreign/eastern-europe/belarus.html',
'https://minsk.page/minsk/','https://www.hotelminsk.by/',
'https://42.tut.by/719082'];
to1 = [];
let str = '';
let pos_start = 0;
let pos_end = 0;
let start = 0;
let sl = '';
for (i=0; i<to.length; i++) {
pos_start = to[i].indexOf('/', 0);
start = pos_start + 2;
pos_end = to[i].indexOf('/', start);
str = to[i].substring(start,pos_end);
to1[i] = str;
}
function fr() {
// alert('hello');
if (n>=p) n=1
else n++;
changeElem();
}
function bc() {
if (n==1) n=6
else n--;
changeElem();
}
function changePic() {
if (n>p) n=1;
changeElem();
n++;
timerId = setTimeout(changePic, 2000);
}
function stop() {
clearTimeout(timerId);
}
function changeElem() {
pic.src=`images/img${n}b.jpg`;
h1.href= to[n-1];
t1.innerHTML = `Заголовок слайда ${n}`;
t2.innerHTML = `<a href="link${n}.html">Подзаголовок слайда ${n}</a>`;
t3.innerHTML = `<a href="${to[n-1]}">${to1[n-1]}</a>`;
}
addEventListener('load', changePic);
sec.addEventListener('mouseover',stop);
// sec.addEventListener('mouseout', changePic);
</script>
</body>
</html>