Skip to content
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

[Term Entry] Javascript document.getElementById #6269

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2f3f8ae
Created a jupyter notebook extesion entry
aatidua Jan 24, 2025
27a255f
Created jupyter notebook extensions entry
aatidua Jan 24, 2025
a95f03f
Update jupyter-notebook-extensions.md
aatidua Jan 24, 2025
b25286e
Definition and some examples updated
aatidua Feb 2, 2025
6e8c42e
Inhave the definition, examples and installation for review
aatidua Feb 5, 2025
2f897ea
Merge branch 'main' into jupyter-extensions-entry
aatidua Feb 5, 2025
419eb5b
Update jupyter-notebook-extensions.md
PragatiVerma18 Feb 7, 2025
9493778
Merge branch 'main' into jupyter-extensions-entry
PragatiVerma18 Feb 7, 2025
8798cad
Update jupyter-notebook-extensions.md
mamtawardhani Feb 7, 2025
bdb981d
Update jupyter-notebook-extensions.md
mamtawardhani Feb 7, 2025
6c82441
Just the beginning of the resizeTo input
aatidua Feb 15, 2025
a9c34bc
It needs to be checked for update
aatidua Feb 15, 2025
4ba5aa2
Merge branch 'main' into javascript-entry
aatidua Feb 15, 2025
93fa864
Merge branch 'main' into javascript-entry
mamtawardhani Feb 16, 2025
ebe7ef9
I have made the improvements
aatidua Feb 16, 2025
8aa030a
Merge branch 'Codecademy:main' into javascript-entry
aatidua Feb 16, 2025
e5d1671
Fix formatting and run script
aatidua Feb 16, 2025
9c14c63
minor fixes
mamtawardhani Feb 17, 2025
48d07a7
Merge branch 'main' into javascript-entry
mamtawardhani Feb 17, 2025
6f55017
Merge branch 'main' into javascript-entry
Sriparno08 Feb 18, 2025
9dc4eec
Minor changes
Sriparno08 Feb 18, 2025
4dc0d41
The folder and the markdown file for scrollTo has started
aatidua Feb 21, 2025
74d7ece
Pseudo code and explanation to variables added
aatidua Feb 22, 2025
312a3b2
ScrollTo.md have been done and needs review
aatidua Feb 22, 2025
b22248d
minor changes
mamtawardhani Feb 24, 2025
93c8872
Merge branch 'main' into javascript-scrollTo-entry
mamtawardhani Feb 24, 2025
bb54868
resizeTo.md has been deleted from the bracnh
aatidua Feb 24, 2025
89747f1
Started the getelementbyid task
aatidua Mar 1, 2025
381774d
resolving error with id
aatidua Mar 2, 2025
0bd7aa2
trying to upload raw data
aatidua Mar 2, 2025
fa9f1bb
Trying to upload the png file
aatidua Mar 2, 2025
f6bcd99
Fixing the image upload
aatidua Mar 2, 2025
bd4fbf6
ready for review
aatidua Mar 2, 2025
55b1a7c
Merge branch 'main' into javascript-getElementById
aatidua Mar 2, 2025
32436ee
Merge branch 'main' into javascript-getElementById
aatidua Mar 7, 2025
eb2020d
Merge branch 'main' into javascript-getElementById
aatidua Mar 8, 2025
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
Prev Previous commit
Next Next commit
minor changes
  • Loading branch information
mamtawardhani authored Feb 24, 2025
commit b22248d6d28046b28958b51954fc91a0668f7716
34 changes: 18 additions & 16 deletions content/javascript/concepts/window/terms/scrollTo/scrollTo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Title: '.scrollTo()'
Description: 'Scrolls document to specified coordinate in pixels'
Subjects:
- 'Web Development'
- 'Computer Science'
- 'Web Development'
Tags:
- 'Arguments'
- 'Functions'
Expand All @@ -13,40 +13,42 @@ CatalogContent:
- 'paths/front-end-engineer-career-path'
---

In Javascript, **`.scrollTo()`** scrolls window document to a specified position in pixels.
In JavaScript, **`.scrollTo()`** scrolls the window or document to a specified position in pixels.

## Syntax

```pseudo
window.scrollTo(x, y)
```

- `x` is the direction in the horizontal direction.
- `y` is the direction in the vertical direction.
- `x`: The horizontal coordinate (in pixels) to scroll to.
- `y`: The vertical coordinate (in pixels) to scroll to.

Or, alternatively:

```pseudo
window.scrollTo(options)
```

- `options` is an object with the following properties:
- `options`: An object with the following optional properties:
- `left`: The horizontal scroll position in pixels.
- `top`: The vertical scroll position in pixels.
- `behavior`: Defines the scrolling behavior. Accepted values:
- `smooth`: Scrolls with an animation.
- `instant`: Scrolls immediately.
- `auto`: Uses the browser's default scrolling behavior.

- `top` is the pixels in the y-axis.
- `left` is the pixels in the x-axis.
- `behavior` is a string that determines whether the crolling is done instant or animates smoothly:
- `smooth` : animate scrolling smoothly.
- `instant` : scrolling is done instant.
- `auto` : scrolling is determined by a computed value of **_scroll-behavior_**.
## Example 1

## Example

The code below scrolls the window to 298 pixels from the left (x-axis) and 57 pixels from the top (y-axis).
The code below scrolls the window to _298_ pixels from the left (x-axis) and _57_ pixels from the top (y-axis) using absolute coordinates:

```js
window.scrollTo(298, 57);
```

Using options:
The code below scrolls the window smoothly 57 pixels from the top (y-axis) and 298 pixels from the left (x-axis).
## Example 2

The code below scrolls the window smoothly to _57_ pixels from the top (y-axis) and _298_ pixels from the left (x-axis) using the options object:

```js
window.scrollTo({
Expand Down