<div style="width: 100%; height: 2000px;">
<div class="instruction">
Scroll Down Please
</div>
</div>
<main>
<section id="panel1-img">
<div class="shape-circle"></div>
</section>
</main>
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
body {
line-height: 1;
}
ol,
ul {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
body {
background-color: #111111;
font-family: sans-serif;
}
#main-img-wrapper {
padding-top: 139px;
text-align: center;
}
#intro-main {
display: flex;
flex-direction: column;
margin: 54px auto 140px;
width: 300px;
align-items: center;
color: white;
font-size: 40px;
font-weight: 500;
gap: 20px;
}
#join-us-text {
margin-top: 73px;
font-size: 16px;
font-weight: 400;
opacity: .6;
}
#intro-main p {
text-align: center;
}
@keyframes upAndDown {
0% {
transform: translateY(0);
}
50% {
transform: translateY(-10px);
}
100% {
transform: translateY(0);
}
}
#down-arrow-icon {
width: 33px;
animation: upAndDown 1s infinite;
}
#list-item-wrapper {
margin: 0 auto 500px;
width: 383px;
}
.list-item {
display: inline;
font-size: 48px;
font-weight: 600;
}
.list-item::before {
display: inline-block;
background-image: url('./icons/dark_house.png');
background-size: 51px 53px;
content: "";
width: 51px;
height: 53px;
}
.list-item#on {
color: white;
}
.list-item#on::before {
background-image: url('./icons/light_house.png');
}
#panel1-img {
margin-bottom: 500px;
position: relative;
height: 400px;
}
.instruction {
color: white;
display: flex;
justify-content: center;
padding: 2rem;
font-weight: bold;
font-size: 2rem;
}
.shape-circle {
width: 400px;
height: 400px;
background-image: linear-gradient(90deg, #FFD700, #FF8C00);
border-radius: 50%;
position: absolute;
right: -200px;
transform-origin: top;
}
document.addEventListener('DOMContentLoaded', () => {
const shapeCircle = document.querySelector('.shape-circle');
const panel1Img = document.querySelector('#panel1-img');
window.addEventListener('scroll', () => {
const scrollValue = window.scrollY;
const panel1ImgTop = panel1Img.offsetTop;
const panel1ImgHeight = panel1Img.clientHeight;
console.log("scrollValue: ", scrollValue);
console.log("panel1ImgTop: ", panel1ImgTop);
console.log("panel1ImgHeight: ", panel1ImgHeight);
if (scrollValue > panel1ImgTop - panel1ImgHeight) {
shapeCircle.style.transform= `rotate(${scrollValue - panel1ImgTop}deg)`;
}
});
})
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.