Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SWLab UI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
SWD
SWLab UI
Commits
8e7ae785
Commit
8e7ae785
authored
Oct 23, 2024
by
minseok.park
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update srcoll-top
parent
70b27eb9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
11-scroll-top.js
src/js/11-scroll-top.js
+8
-8
No files found.
src/js/11-scroll-top.js
View file @
8e7ae785
...
...
@@ -5,14 +5,14 @@
const
scrollToTopButton
=
document
.
querySelector
(
'.top-scroll-btn'
)
// 스크롤 이벤트 핸들러
window
.
addEventListener
(
'scroll'
,
function
()
{
// 페이지가 300px 이상 스크롤되었을 때 버튼 표시
if
(
window
.
scrollY
>
300
)
{
scrollToTopButton
.
style
.
display
=
'flex'
}
else
{
scrollToTopButton
.
style
.
display
=
'none'
}
})
//
window.addEventListener('scroll', function () {
//
// 페이지가 300px 이상 스크롤되었을 때 버튼 표시
//
if (window.scrollY > 300) {
//
scrollToTopButton.style.display = 'flex'
//
} else {
//
scrollToTopButton.style.display = 'none'
//
}
//
})
// 버튼 클릭 시 페이지 상단으로 스크롤
scrollToTopButton
.
addEventListener
(
'click'
,
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment