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

[오타수정] Part 2 - 1.11 좌표 #1599 #1600

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
neuwcodebox wants to merge 1 commit into javascript-tutorial:master
base: master
Choose a base branch
Loading
from neuwcodebox:patch-1
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
4 changes: 2 additions & 2 deletions 2-ui/1-document/11-coordinates/article.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ alert(elem.tagName);

```js
let elem = document.elementFromPoint(x, y);
// 요소가 창 밖으로 나가면 lem = null
// 요소가 창 밖으로 나가면 elem = null
*!*
elem.style.background = ''; // 에러!
*/!*
Expand Down Expand Up @@ -199,7 +199,7 @@ setTimeout(() => message.remove(), 5000);

CSS와 비교하자면 창 기준 좌표는 `position:fixed`에 해당하고 문서 기준 좌표는 맨 위 기준 `position:absolute`와 비슷합니다.

문서 내 특정 좌표에 무언가를 위치시키고 싶을 땐 `position:absolute`와 `top, `left`를 사용하면 스크롤 이동에 상관없이 해당 요소를 한 좌표에 머물게 할 수 있습니다. 그러려면 우선 정확한 좌표가 필요합니다.
문서 내 특정 좌표에 무언가를 위치시키고 싶을 땐 `position:absolute`와 `top/left`를 사용하면 스크롤 이동에 상관없이 해당 요소를 한 좌표에 머물게 할 수 있습니다. 그러려면 우선 정확한 좌표가 필요합니다.

그런데 요소의 문서 기준 좌표를 제공하는 표준 메서드가 아직 없습니다. 하지만 아주 쉽게 코드를 작성할 수 있습니다.

Expand Down

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