-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
124 lines (105 loc) · 3.57 KB
/
script.js
File metadata and controls
124 lines (105 loc) · 3.57 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
document.addEventListener("DOMContentLoaded", function() {
const hamburger = document.querySelector('.hamburger');
const navMenu = document.querySelector('.nav-links');
const navLinks = document.querySelectorAll('.nav-links li a');
const backToTopButton = document.querySelector('.back-to-top-button');
// Toggle mobile menu
hamburger.addEventListener('click', function() {
navMenu.classList.toggle('active');
});
// Close menu when a nav link is clicked
navLinks.forEach(link => {
link.addEventListener('click', function() {
navMenu.classList.remove('active'); // Close the menu
});
});
// Close menu when back to top button is clicked
if (backToTopButton) {
backToTopButton.addEventListener('click', function() {
navMenu.classList.remove('active'); // Close the menu
});
}
});
document.addEventListener("scroll", function() {
const elements = document.querySelectorAll('.fade-in');
const windowHeight = window.innerHeight;
elements.forEach((element) => {
const position = element.getBoundingClientRect().top;
// Check if the element is in view and hasn't animated yet
if (position < windowHeight - 100 && !element.classList.contains('animated')) {
element.style.animationPlayState = "running"; // Start animation
element.classList.add('animated'); // Mark as animated
}
});
});
document.addEventListener("DOMContentLoaded", function() {
// Function to check if the 'cookiesAccepted' cookie exists
function getCookie(name) {
let value = "; " + document.cookie;
let parts = value.split("; " + name + "=");
if (parts.length === 2) return parts.pop().split(";").shift();
}
// Check if the user has already accepted cookies
if (!getCookie('cookiesAccepted')) {
document.getElementById('cookie-banner').style.display = 'block';
}
document.getElementById('accept-cookies').onclick = function() {
document.getElementById('cookie-banner').style.display = 'none';
// Set a cookie to remember the user's choice for 1 year
document.cookie = "cookiesAccepted=true; max-age=" + 60*60*24*365 + "; path=/";
};
});
function scrollToTop() {
window.scrollTo({ top: 0, behavior: 'smooth' });
}
$(document).ready(function(){
$('.service-carousel').slick({
slidesToShow: 3, // Number of testimonials to show at once
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 5000,
dots: true,
arrows: true,
responsive: [
{
breakpoint: 1024, // Adjust for mid-sized screens (tablets)
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 768, // For mobile screens
settings: {
slidesToShow: 1, // Show 1 slide on small screens
slidesToScroll: 1
}
},
{
breakpoint: 480, // Smaller mobile screens
settings: {
slidesToShow: 1, // Show 1 slide on small screens
slidesToScroll: 1
}
}
]
});
});
$(document).ready(function(){
$('.testimonials-carousel').slick({
slidesToShow: 2, // Number of testimonials to show at once
slidesToScroll: 1,
autoplay: true, // Auto-scroll the testimonials
autoplaySpeed: 5000, // Delay between slides
dots: true, // Add dots for navigation
arrows: false, // Disable arrows for cleaner look
responsive: [
{
breakpoint: 768, // Mobile view, only show 1 testimonial at a time
settings: {
slidesToShow: 1
}
}
]
});
});