From 5b68373e9b08b5ab60d59985dff55ab238a635ca Mon Sep 17 00:00:00 2001 From: NerdyPepper Date: Fri, 2 Aug 2019 21:06:34 +0530 Subject: fix anchors [episode 2] --- script/gotoId.js | 6 ++++++ script/showPost.js | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 script/gotoId.js (limited to 'script') diff --git a/script/gotoId.js b/script/gotoId.js new file mode 100644 index 0000000..991bf1d --- /dev/null +++ b/script/gotoId.js @@ -0,0 +1,6 @@ +function gotoId() { + if ( window.location.hash ) { + let hash = window.location.hash.substring(1); + showPost(hash); + } +} diff --git a/script/showPost.js b/script/showPost.js index 07a9719..75ffa1c 100644 --- a/script/showPost.js +++ b/script/showPost.js @@ -6,4 +6,3 @@ function showPost(id) { post.style.display = "none"; } } - -- cgit v1.2.3