Skip to content

[내용번역] Part 2. 3.5 Scrolling #739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions 2-ui/3-event-details/8-onscroll/article.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Scrolling
# 스크롤

The `scroll` event allows to react on a page or element scrolling. There are quite a few good things we can do here.
`scroll` 이벤트는 페이지나 요소에서 스크롤 했을 경우 반응할 수 있게 해줍니다. 해볼 수 있는 몇 가지 좋은 사례들이 있습니다.

For instance:
- Show/hide additional controls or information depending on where in the document the user is.
- Load more data when the user scrolls down till the end of the page.
예시:
- 문서에서 사용자가 위치한 곳에 따라 추가 제어 요소 또는 정보를 표시하거나 숨긴다.
- 사용자가 페이지 끝까지 스크롤을 내릴 경우 더 많은 데이터를 불러온다.
Comment on lines +6 to +7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

경어체를 유지해주세요.

명사형으로 끝나는 문장은 경어체가 아니어도 됩니다.

~숨김, ~불러옴


Here's a small function to show the current scroll:
다음은 현재 스크롤 위치를 출력하는 간단한 함수입니다.

```js autorun
window.addEventListener('scroll', function() {
Expand All @@ -15,23 +15,23 @@ window.addEventListener('scroll', function() {
```

```online
In action:
작동 중:

Current scroll = <b id="showScroll">scroll the window</b>
현재 스크롤 위치 = <b id="showScroll">scroll the window</b>
```

The `scroll` event works both on the `window` and on scrollable elements.
`scroll` 이벤트는 `window`와 스크롤 가능한 요소에서 동작합니다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

스크롤 가능한 요소라고 번역하면 조금 헷갈릴수있으니 한영병기해주는게 어떨지 제의드려봅니다.

스크롤 가능한 요소(scrollable element)


## Prevent scrolling
## 스크롤 방지

How do we make something unscrollable?
어떻게 스크롤이 불가능하도록 만들 수 있을까요?

We can't prevent scrolling by using `event.preventDefault()` in `onscroll` listener, because it triggers *after* the scroll has already happened.
`onscroll` 리스너에서 `event.preventDefault()`로 스크롤을 막는 것은 onscroll 리스너가 스크롤이 이미 발생한 뒤에 동작하기 때문에 불가능합니다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 원문에서 after를 강조했는데, 그부분이 빠져있네요.
  2. onscroll 리스너가 스크롤이 이미 발생한 뒤에 <-- 이부분이 이상합니다. 문장 확인해주세요.


But we can prevent scrolling by `event.preventDefault()` on an event that causes the scroll, for instance `keydown` event for `key:pageUp` and `key:pageDown`.
하지만 `key:pageUp`이나 `key:pageDown`과 같은 `keydown` 이벤트처럼 스크롤을 일으키는 이벤트의 경우에는 `event.preventDefault()`로 스크롤이 동작하는 것을 방지할 수 있습니다.

If we add an event handler to these events and `event.preventDefault()` in it, then the scroll won't start.
이와 같은 이벤트에 이벤트 핸들러와 `event.preventDefault()`를 추가한다면 스크롤은 시작되지 않습니다.

There are many ways to initiate a scroll, so it's more reliable to use CSS, `overflow` property.
스크롤을 일으키는 방법은 많습니다. 그렇기 때문에 CSS의 `overflow` 프로퍼티를 사용하는 것이 더 안전합니다.

Here are few tasks that you can solve or look through to see the applications on `onscroll`.
다음은 `onscroll`이 적용된 애플리케이션을 이해하기 위해 해결하거나 살펴볼 수 있는 몇 가지 과제입니다.