-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathheaderFooter.js
More file actions
35 lines (33 loc) · 1003 Bytes
/
headerFooter.js
File metadata and controls
35 lines (33 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* header, footer*/
const headerFooterComponent = () => {
const headerId = document.querySelector("#header");
const footerId = document.querySelector("#footer");
if (headerId) {
const header = fetch("header.html");
header
.then((res) => res.text())
.then((text) => {
document.querySelector("#header").innerHTML = text;
});
}
if (footerId) {
const footer = fetch("footer.html");
footer
.then((res) => res.text())
.then((text) => {
document.querySelector("#footer").innerHTML = text;
let style = document.createElement("link");
style.href = "headerFooter.css";
style.rel = "stylesheet";
document.head.appendChild(style);
});
}
};
headerFooterComponent();
/*header nav바 페이지스크롤 이동 */
$(document).ready(function ($) {
$(".scroll_move").click(function (event) {
event.preventDefault();
$("html,body").animate({ scrollTop: $(this.hash).offset().top }, 500);
});
});