-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (24 loc) · 775 Bytes
/
script.js
File metadata and controls
30 lines (24 loc) · 775 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
// script.js
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// script.js
// Add animation to the link on click
document.querySelector('.animated-link').addEventListener('click', function(event) {
event.preventDefault();
event.target.classList.add('animated');
setTimeout(function() {
event.target.classList.remove('animated');
}, 1000);
});
// script.js
function applyEffect() {
var image = document.getElementById('myImage');
image.classList.toggle('rotate');
}