-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.mjs
61 lines (50 loc) · 2.08 KB
/
main.mjs
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import './main.css'
import './src/css/style.css'
import 'flowbite'
/* @formatter:off */
// Calling Function to Reset Contact Form Window Reload / Refresh
import {clearForm} from "./src/js/contact.mjs";
clearForm();
// Importing the section "pages"
import {homePageContent, aboutPageContent, portfolioPageContent, contactPageContent} from './src/js/pages.mjs';
// Buttons to Open Popup "Download" Modal
[...document.querySelectorAll('.download-file-btn')].forEach(function (download) {
download.addEventListener('click', function () {
document.querySelector('.download-popup').style.display = 'block';
});
});
// Buttons to Close Popup Modals
[...document.querySelectorAll('.close-popup-btn')].forEach(function (close) {
close.addEventListener('click', function () {
document.querySelector('.download-popup').style.display = 'none';
document.querySelector('.contact-popup').style.display = 'none';
});
});
// All buttons with class "home-page-button" will run function homePageContent
[...document.querySelectorAll('.home-page-btn')].forEach(function (home) {
home.addEventListener('click', function () {
homePageContent();
});
});
// All buttons with class "about-page-button" will run function aboutPageContent
[...document.querySelectorAll('.about-page-btn')].forEach(function (about) {
about.addEventListener('click', function () {
aboutPageContent();
});
});
// All buttons with class "portfolio-page-button" will run function portfolioPageContent
[...document.querySelectorAll('.portfolio-page-btn')].forEach(function (portfolio) {
portfolio.addEventListener('click', function () {
portfolioPageContent();
});
});
// All buttons with class "contact-page-button" will run function contactPageContent
[...document.querySelectorAll('.contact-page-btn')].forEach(function (contact) {
contact.addEventListener('click', function () {
contactPageContent();
});
});
document.getElementById('backToTop').addEventListener('click', () => {
console.log("Button to top clicked");
window.scrollTo(document.top);
})