forked from thecyberbuzz/anycode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPortfoliocode
108 lines (92 loc) · 2.33 KB
/
Portfoliocode
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//html file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Portfolio</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<nav>
<ul>
<li><a href="#about">About</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
<script src="script.js"></script>
</header>
<section id="about">
<h1>About Me</h1>
<!-- Your about me content here -->
</section>
<section id="portfolio">
<h1>Portfolio</h1>
<!-- Your portfolio items here -->
</section>
<section id="contact">
<h1>Contact Me</h1>
<!-- Your contact form or contact information here -->
</section>
<footer>
<p>© 2023 Your Name</p>
</footer>
</body>
</html>
//css file
/* Add your CSS styles here to style your website */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header {
background-color: #333;
color: #fff;
padding: 20px;
}
nav ul {
list-style-type: none;
margin: 0;
padding: 0;
}
nav ul li {
display: inline;
margin-right: 20px;
}
nav ul li a {
text-decoration: none;
color: #fff;
}
section {
padding: 50px;
}
footer {
background-color: #333;
color: #fff;
text-align: center;
padding: 10px;
}
//js file
// Smooth scrolling for navigation links
document.addEventListener("DOMContentLoaded", function () {
const navLinks = document.querySelectorAll("nav ul li a");
navLinks.forEach((link) => {
link.addEventListener("click", function (event) {
event.preventDefault();
const targetId = this.getAttribute("href").substring(1);
const targetElement = document.getElementById(targetId);
if (targetElement) {
const yOffset = -50; // Adjust this value as needed for proper scrolling position
const y =
targetElement.getBoundingClientRect().top + window.pageYOffset + yOffset;
window.scrollTo({
top: y,
behavior: "smooth",
});
}
});
});
});