Skip to content

Commit 64f52be

Browse files
Scroll to top btn and copyright year added with updated code.
1 parent 5710e1f commit 64f52be

File tree

4 files changed

+48
-5
lines changed

4 files changed

+48
-5
lines changed

Diff for: copyrightYear.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let copyRightYear = document.getElementById("copyright-year");
2+
let currentDate = new Date();
3+
let currentYear = currentDate.getFullYear();
4+
copyRightYear.innerText = currentYear;

Diff for: main.html

+10-5
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ <h3>More Features Coming Soon</h3>
129129

130130
<footer>
131131
<div class="footer-container">
132+
132133
<div class="company-info">
133134
<h1 class="company-name heading flex justify-center items-center gap-4 "><img
134135
src="./assets/logo.png">Dev-Mint</h1>
@@ -177,11 +178,13 @@ <h1 class="heading">Keep In Touch</h1>
177178
</div>
178179
</div>
179180

180-
<p class="copyright">Built with ❤️ by Dev-Mint Team | ©
181-
<script>
182-
document.write(new Date().getFullYear());
183-
</script>: All Rights Reserved
184-
</p>
181+
<p>&copy; <span id="copyright-year"></span> All Rights Reserved || Built with ❤️ by Dev-Mint Team</p>
182+
<button id="goto-top-btn" onclick="goTop()"><svg xmlns="http://www.w3.org/2000/svg" width="25" height="25"
183+
fill="green" class="bi bi-arrow-up" viewBox="0 0 16 16">
184+
<path fill-rule="evenodd"
185+
d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5" />
186+
</svg>
187+
</button>
185188
</footer>
186189

187190
<script>
@@ -205,6 +208,8 @@ <h1 class="heading">Keep In Touch</h1>
205208
document.getElementById("mobile-nav").classList.toggle("hidden");
206209
}
207210
</script>
211+
<script src="./copyrightYear.js"></script>
212+
<script src="./scrollTop.js"></script>
208213
</body>
209214

210215
</html>

Diff for: scrollTop.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
let scrollTopBtn = document.getElementById("goto-top-btn");
2+
3+
const showTopBtn = () => {
4+
if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {
5+
scrollTopBtn.style.display = "block";
6+
} else {
7+
scrollTopBtn.style.display = "none";
8+
}
9+
};
10+
11+
const goTop= ()=>{
12+
document.body.scrollTop = 0;
13+
document.documentElement.scrollTop = 0;
14+
}
15+
window.onscroll = () => {
16+
showTopBtn();
17+
};

Diff for: style.css

+17
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,23 @@ footer {
549549
color: #5865F2;
550550
}
551551

552+
#goto-top-btn {
553+
background-color: white;
554+
padding: 15px 19px;
555+
border: none;
556+
border-radius: 50%;
557+
position: fixed;
558+
bottom: 55px;
559+
right: 30px;
560+
display: none;
561+
border: 5px solid red;
562+
cursor: pointer;
563+
}
564+
565+
#goto-top-btn:hover {
566+
background-color: #bdbaba;
567+
}
568+
552569
@keyframes animate {
553570
50% {
554571
transform: translateY(-8px);

0 commit comments

Comments
 (0)