Add smooth scrolling to different sections when associated link/button is clicked
This commit is contained in:
23
app.js
Normal file
23
app.js
Normal file
@@ -0,0 +1,23 @@
|
||||
// Smooth scroll to portfolio section when link is clicked
|
||||
document.querySelector("#websites-link").addEventListener("click", function(event){
|
||||
event.preventDefault()
|
||||
setTimeout(() => {
|
||||
document.querySelector("#portfolio").scrollIntoView({ behavior: "smooth" });
|
||||
}, 150);
|
||||
});
|
||||
|
||||
// Smooth scroll to contact form when button is clicked
|
||||
document.querySelector("#contact-button").addEventListener("click", function(event){
|
||||
event.preventDefault()
|
||||
setTimeout(() => {
|
||||
document.querySelector("#contact").scrollIntoView({ behavior: "smooth" });
|
||||
}, 150);
|
||||
});
|
||||
|
||||
// Smooth scroll to experience section when link is clicked
|
||||
document.querySelector("#experience-link").addEventListener("click", function(event){
|
||||
event.preventDefault()
|
||||
setTimeout(() => {
|
||||
document.querySelector("#experience").scrollIntoView({ behavior: "smooth" });
|
||||
}, 150);
|
||||
});
|
Reference in New Issue
Block a user