From 8cbe92ca46a08d09e857a4a022a72af4ece30439 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 7 Dec 2021 02:27:42 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20anchor=20=EC=9D=B4=EB=8F=99=EC=97=90?= =?UTF-8?q?=EC=84=9C=20#=EC=9D=84=20=EB=82=A8=EA=B8=B0=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8F=84=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/index.php | 28 ++++++++++++++-------------- hwe/ts/main.ts | 2 ++ hwe/ts/util/scrollHardTo.ts | 9 +++++++++ 3 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 hwe/ts/util/scrollHardTo.ts diff --git a/hwe/index.php b/hwe/index.php index c68d238f..434e8a4b 100644 --- a/hwe/index.php +++ b/hwe/index.php @@ -274,7 +274,7 @@ if (!$otherTextInfo) {
- +
@@ -353,23 +353,23 @@ if (!$otherTextInfo) { ?>
- 방침 - 명령 - 국가 - 장수 - 도시 + + + + +
- 지도 - 동향 - 개인 - 정세 + + + +
- 전체 - 국가 - 개인 - 외교 + + + +
diff --git a/hwe/ts/main.ts b/hwe/ts/main.ts index cea2ffbd..528e1836 100644 --- a/hwe/ts/main.ts +++ b/hwe/ts/main.ts @@ -7,7 +7,9 @@ import './msg.ts'; import './map.ts'; import { exportWindow } from './util/exportWindow'; +import { scrollHardTo } from './util/scrollHardTo'; +exportWindow(scrollHardTo, 'scrollHardTo'); exportWindow($, '$'); import '../scss/main.scss'; diff --git a/hwe/ts/util/scrollHardTo.ts b/hwe/ts/util/scrollHardTo.ts new file mode 100644 index 00000000..3efa8262 --- /dev/null +++ b/hwe/ts/util/scrollHardTo.ts @@ -0,0 +1,9 @@ +export function scrollHardTo(elementId: string): void { + const element = document.getElementById(elementId); + if(!element){ + return; + } + element.scrollIntoView({ + behavior: 'auto', + }); + } \ No newline at end of file