-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
45 lines (36 loc) · 1.13 KB
/
script.js
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
// Smooth scrolling
$('a').on('click', function (event) {
if (this.hash !== '') {
event.preventDefault();
const hash = this.hash;
$('html, body').animate(
{
scrollTop: $(hash).offset().top,
},
800
);
}
});
// Slide-in animation on scroll
$(window).scroll(function () {
$('.slide-in').each(function () {
const slideInPos = $(this).offset().top + 50;
const windowHeight = $(window).height();
const scrollPos = $(window).scrollTop() + windowHeight;
if (scrollPos > slideInPos) {
$(this).addClass('active');
}
});
});
// Toggle mobile navigation menu
$('.menu-toggle').click(function () {
$('nav ul').slideToggle(300); // Adjust the duration (300 milliseconds) to control the speed of the animation
$(this).toggleClass('active');
});
document.querySelector('.menu-toggle').addEventListener('click', function() {
this.classList.toggle('active');
document.querySelector('nav').classList.toggle('show');
});
// Show current year in the footer
const currentYear = new Date().getFullYear();
$('footer p').html(`© ${currentYear} Pathways School Noida Student Council`);