-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
137 lines (123 loc) · 4.73 KB
/
Copy pathscript.js
File metadata and controls
137 lines (123 loc) · 4.73 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
125
126
127
128
129
130
131
132
133
134
135
136
137
function scrollToSection(contact) {
const section = document.getElementById(contact);
if (section) {
section.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
}
function toggleMenu() {
const navMenu = document.getElementById('nav-menu');
const hamburger = document.querySelector('.hamburger');
navMenu.classList.toggle('show');
hamburger.classList.toggle('active');
}
// Previous JavaScript functions remain unchanged
function addPetCards() {
const petsList = document.getElementById('pets-list');
const pets = [
{ name: 'Rocky', type: 'Dog', breed: 'Labrador', age: '3 years', image: '/images home/6.jpg',
info: {
Owner: "John Doe",
Contact: "12345",
Address: "Hover Lane, XYZ",
Availability: "Yes"
} },
{ name: 'Whiskers', type: 'Cat', breed: 'Siamese', age: '2 years', image: '/images home/4.jpg',
info: {
Owner: "John Doe",
Contact: "12345",
Address: "Hover Lane, XYZ",
Availability: "Yes"
}
},
{ name: 'Buddy', type: 'Dog', breed: 'Golden Retriever', age: '5 years', image: '/images home/3.jpg',
info: {
Owner: "John Doe",
Contact: "12345",
Address: "Hover Lane, XYZ",
Availability: "Yes"
}
},
{ name: 'Mittens', type: 'Cat', breed: 'Persian', age: '4 years', image: '/images home/8.jpg',
info: {
Owner: "John Doe",
Contact: "12345",
Address: "Hover Lane, XYZ",
Availability: "Yes"
}
},
{ name: 'Rex', type: 'Dog', breed: 'German Shepherd', age: '6 years', image: '/images home/5.jpg',
info: {
Owner: "John Doe",
Contact: "12345",
Address: "Hover Lane, XYZ",
Availability: "Yes"
}
},
{ name: 'Fluffy', type: 'Cat', breed: 'Maine Coon', age: '1 year', image: 'images home/fluffy.jpg',
info: {
Owner: "John Doe",
Contact: "12345",
Address: "Hover Lane, XYZ",
Availability: "Yes"
}
}
];
pets.forEach(pet => {
const petCard = document.createElement('div');
petCard.className = 'pet-card';
petCard.innerHTML = `
<img src="${pet.image}" alt="${pet.name}">
<h4>${pet.name}</h4>
<p>${pet.breed}</p>
<p>${pet.age}</p>
<div class="info-box">
<h4>${pet.name}</h4>
<strong>Owner: </strong>${pet.info.Owner}<br>
<strong>Address: </strong>${pet.info.Address}<br>
<strong>Contact: </strong>${pet.info.Contact}<br>
<strong>Availability: </strong>${pet.info.Availability}<br>
</div>
`;
petsList.appendChild(petCard);
});
}
function adoptPet(petName) {
alert(`Thank you for your interest in adopting ${petName}! Please contact us to proceed with the adoption process.`);
}
function adoptPet(petName) {
alert(`Thank you for your interest in adopting ${petName}! Please contact us to proceed with the adoption process.`);
}
// Call the function to add pet cards when the page loads
window.onload = addPetCards;
function donate(amount) {
alert(`Thank you for your donation of ₹${amount}! Your support makes a huge difference.`);
// Here you would typically integrate with a payment gateway
}
function donateCustom() {
const amount = document.getElementById('custom-amount').value;
if (amount && !isNaN(amount)) {
alert(`Thank you for your custom donation of ₹${amount}! Your generosity is appreciated.`);
// Here you would typically integrate with a payment gateway
} else {
alert('Please enter a valid amount.');
}
}
document.addEventListener('DOMContentLoaded', function() {
const gallery = document.querySelector('.testimonial-gallery');
const cards = document.querySelectorAll('.testimonial-card');
// Clone the testimonial cards
cards.forEach(card => {
const clone = card.cloneNode(true);
gallery.appendChild(clone);
});
// Adjust the animation duration based on the number of cards
const totalCards = gallery.children.length;
const cardWidth = 300; // width of each card
const gapWidth = 20; // gap between cards
const totalWidth = totalCards * (cardWidth + gapWidth);
const animationDuration = totalWidth / 50; // Adjust speed as needed
gallery.style.animationDuration = `${animationDuration}s`;
});