Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b3cd77e

Browse files
Added day 27 related html file
1 parent 4337eca commit b3cd77e

File tree

2 files changed

+147
-0
lines changed

2 files changed

+147
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Click and Drag</title>
6+
<link rel="stylesheet" href="style.css">
7+
</head>
8+
<body>
9+
<div class="items">
10+
<div class="item item1">01</div>
11+
<div class="item item2">02</div>
12+
<div class="item item3">03</div>
13+
<div class="item item4">04</div>
14+
<div class="item item5">05</div>
15+
<div class="item item6">06</div>
16+
<div class="item item7">07</div>
17+
<div class="item item8">08</div>
18+
<div class="item item9">09</div>
19+
<div class="item item10">10</div>
20+
<div class="item item11">11</div>
21+
<div class="item item12">12</div>
22+
<div class="item item13">13</div>
23+
<div class="item item14">14</div>
24+
<div class="item item15">15</div>
25+
<div class="item item16">16</div>
26+
<div class="item item17">17</div>
27+
<div class="item item18">18</div>
28+
<div class="item item19">19</div>
29+
<div class="item item20">20</div>
30+
<div class="item item21">21</div>
31+
<div class="item item22">22</div>
32+
<div class="item item23">23</div>
33+
<div class="item item24">24</div>
34+
<div class="item item25">25</div>
35+
</div>
36+
37+
<script>
38+
const slider = document.querySelector('.items');
39+
let isDown = false;
40+
let startX;
41+
let scrollLeft;
42+
43+
slider.addEventListener('mousedown', (e) => {
44+
isDown = true;
45+
slider.classList.add('active');
46+
startX = e.pageX - slider.offsetLeft;
47+
scrollLeft = slider.scrollLeft;
48+
});
49+
50+
slider.addEventListener('mouseleave', () => {
51+
isDown = false;
52+
slider.classList.remove('active');
53+
});
54+
55+
slider.addEventListener('mouseup', () => {
56+
isDown = false;
57+
slider.classList.remove('active');
58+
});
59+
60+
slider.addEventListener('mousemove', (e) => {
61+
if (!isDown) return; // stop the fn from running
62+
e.preventDefault();
63+
const x = e.pageX - slider.offsetLeft;
64+
const walk = (x - startX) * 3;
65+
slider.scrollLeft = scrollLeft - walk;
66+
});
67+
68+
</script>
69+
70+
</body>
71+
</html>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
html {
2+
box-sizing: border-box;
3+
background: url('https://source.unsplash.com/NFs6dRTBgaM/2000x2000') fixed;
4+
background-size: cover;
5+
}
6+
7+
*, *:before, *:after {
8+
box-sizing: inherit;
9+
}
10+
11+
body {
12+
min-height: 100vh;
13+
display: flex;
14+
justify-content: center;
15+
align-items: center;
16+
font-family: sans-serif;
17+
font-size: 20px;
18+
margin: 0;
19+
}
20+
21+
.items {
22+
height:800px;
23+
padding: 100px;
24+
width:100%;
25+
border:1px solid white;
26+
box-shadow: 0 0 10px 7px rgba(0, 0, 0, 0.09);
27+
overflow-x: scroll;
28+
overflow-y: hidden;
29+
white-space: nowrap;
30+
user-select: none;
31+
cursor: pointer;
32+
transition: all 0.2s;
33+
transform: scale(0.98);
34+
position: relative;
35+
background: rgba(255,255,255,0.1);
36+
font-size: 0;
37+
perspective: 500px;
38+
}
39+
40+
.items.active {
41+
background: rgba(255,255,255,0.3);
42+
cursor: grabbing;
43+
cursor: -webkit-grabbing;
44+
transform: scale(1);
45+
}
46+
47+
.item {
48+
width:200px;
49+
height: calc(100% - 40px);
50+
display: inline-flex;
51+
align-items: center;
52+
justify-content: center;
53+
font-size: 80px;
54+
font-weight: 100;
55+
color:rgba(0,0,0,0.15);
56+
box-shadow: inset 0 0 0 10px rgba(0,0,0,0.15);
57+
}
58+
59+
.item:nth-child(9n+1) { background: dodgerblue;}
60+
.item:nth-child(9n+2) { background: goldenrod;}
61+
.item:nth-child(9n+3) { background: paleturquoise;}
62+
.item:nth-child(9n+4) { background: gold;}
63+
.item:nth-child(9n+5) { background: cadetblue;}
64+
.item:nth-child(9n+6) { background: tomato;}
65+
.item:nth-child(9n+7) { background: lightcoral;}
66+
.item:nth-child(9n+8) { background: darkslateblue;}
67+
.item:nth-child(9n+9) { background: rebeccapurple;}
68+
69+
.item:nth-child(even) { transform: scaleX(1.31) rotateY(40deg); }
70+
.item:nth-child(odd) { transform: scaleX(1.31) rotateY(-40deg); }
71+
72+
.wrap {
73+
width: auto;
74+
border:2px solid green;
75+
height: 100%;
76+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /