タイトルの内容になります。
クリックさたら、bodyタグに下記が指定され、
fiexd{
position: fixed;
width: 100%;
height: 100%;
}
bodyタグにスクロールされた値が、付与され、閉じるときに下記の関数が実行されるとゆう流れになります。
function stop() {
let body = document.getElementsByTagName("body")[0];
let body_style = body.getAttribute("style").replace("top:", "");
delete_element(body_style);
}
function delete_element(num) {
if (typeof num === "string") {
re_px = num.replace("px", "");
re_fix = re_px.replace("-", "");
type_elm = Number(re_fix);
window.scrollTo(0, type_elm);
}
}
行っていることは大変単純なので、よかったら、利用してみていただけたらと思います。