Window.scrollBy()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015ë 7ì.
Window.scrollBy() ë©ìëë ì°½ì ìë 문ì를 ì§ì ë ìë§í¼ ì¤í¬ë¡¤í©ëë¤.
구문
scrollBy(x-coord, y-coord)
scrollBy(options)
매ê°ë³ì
x-coordë ì¤í¬ë¡¤í ìí í½ì ê°ì ëë¤.y-coordë ì¤í¬ë¡¤í ìì§ í½ì ê°ì ëë¤.
- í¹ì -
options-
ë¤ì 매ê°ë³ìê° í¬í¨ë ì¬ì .
top-
ì°½ ëë ìì를 ì¤í¬ë¡¤í Yì¶ì ë°ë¼ í½ì ì를 ì§ì í©ëë¤.
left-
ì°½ ëë ìì를 ì¤í¬ë¡¤í Xì¶ì ë°ë¼ í½ì ì를 ì§ì í©ëë¤.
behavior-
ì¤í¬ë¡¤ì´ ë¶ëë½ê² ì ëë©ì´ì ëëì§ (
smooth), í ë²ì ì íë¡ ì¦ì ì¤íëëì§ (instant), ëë ë¸ë¼ì°ì ê° ì ííëë¡ í ì§ (auto, 기본)를 ì§ì í©ëë¤.
ë°í ê°
ìì (undefined).
ìì
í íì´ì§ ìëë¡ ì¤í¬ë¡¤íë ¤ë©´.
window.scrollBy(0, window.innerHeight);
ìë¡ ì¤í¬ë¡¤íë ¤ë©´.
window.scrollBy(0, -window.innerHeight);
options ì¬ì©.
window.scrollBy({
top: 100,
left: 100,
behavior: "smooth",
});
ì°¸ê³
window.scroll()ê° ë¬¸ìì ì ë ìì¹ë¡ ì¤í¬ë¡¤íëë° ë°í´, window.scrollBy()ë í¹ì ìë§í¼ ì¤í¬ë¡¤í©ëë¤.
window.scrollByLines()ì window.scrollByPages()를 참조íììì¤.
ëª ì¸ì
| Specification |
|---|
| CSSOM View Module > # dom-window-scrollby > |