Skip to content

Commit

Permalink
Update script3.js
Browse files Browse the repository at this point in the history
Added the .sliding effect for the images
  • Loading branch information
Shivangisharma4 authored Oct 7, 2024
1 parent 2776863 commit b7953d8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion script3.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,20 @@ function validateInputs1(){
}else{
alert("Registered successfully");
}
}
}
function triggerSlidingEffect() {
// On image click
document.querySelectorAll('#gallery .image-container img').forEach(img => {
img.addEventListener('click', function() {
this.classList.toggle('sliding'); // Add or remove sliding effect
});
});

// On scroll
window.addEventListener('scroll', () => {
document.querySelectorAll('#gallery .image-container img').forEach(img => {
img.classList.add('sliding'); // Add sliding effect on scroll
});
});

}

0 comments on commit b7953d8

Please sign in to comment.