Сделай так, чтобы кнопки с текстом "Главная" (одна в футере, другая в выпадающем меню по иконке с тремя линиями) при нажатии выполняли следующие действия: 1. Прокручивали страницу в самое начало (scroll to top). 2. Сбрасывали все поисковые фильтры, поля поиска и сортировки на странице в исходное состояние. 3. Обновляли контент так, как при первоначальной загрузке страницы (показывать все объекты без фильтров). 4. Работали одинаково для обеих кнопок "Главная" независимо от их расположения. Реализуй это так, чтобы всё срабатывало мгновенно и на мобильных устройствах, и на ПК. - Follow Up Deployment
Browse files- index.html +25 -17
index.html
CHANGED
|
@@ -337,7 +337,7 @@
|
|
| 337 |
<a href="#" id="logo-link" class="text-2xl font-bold gold-text hover:text-yellow-300 transition">Venera Rielt</a>
|
| 338 |
</div>
|
| 339 |
<nav class="hidden md:flex space-x-8">
|
| 340 |
-
<a href="#" class="nav-link text-white hover:text-gold-500 transition">Главная</a>
|
| 341 |
<a href="#properties" class="nav-link text-white hover:text-gold-500 transition">Объекты</a>
|
| 342 |
<a href="#agents" class="nav-link text-white hover:text-gold-500 transition">Специалисты</a>
|
| 343 |
<a href="#about" class="nav-link text-white hover:text-gold-500 transition">О компании</a>
|
|
@@ -356,7 +356,7 @@
|
|
| 356 |
<!-- Mobile menu -->
|
| 357 |
<div id="mobile-menu" class="hidden md:hidden glass-effect w-full">
|
| 358 |
<div class="px-2 pt-2 pb-3 space-y-1 sm:px-3">
|
| 359 |
-
<a href="#" class="block px-3 py-2 text-white hover:bg-gray-800 rounded-md">Главная</a>
|
| 360 |
<a href="#properties" class="block px-3 py-2 text-white hover:bg-gray-800 rounded-md">Объекты</a>
|
| 361 |
<a href="#agents" class="block px-3 py-2 text-white hover:bg-gray-800 rounded-md">Специалисты</a>
|
| 362 |
<a href="#about" class="block px-3 py-2 text-white hover:bg-gray-800 rounded-md">О компании</a>
|
|
@@ -1069,7 +1069,7 @@
|
|
| 1069 |
|
| 1070 |
<div class="mb-6 md:mb-0">
|
| 1071 |
<nav class="flex flex-wrap justify-center gap-4 md:gap-8">
|
| 1072 |
-
<a href="#" class="text-gray-400 hover:text-white transition">Главная</a>
|
| 1073 |
<a href="#properties" class="text-gray-400 hover:text-white transition">Объекты</a>
|
| 1074 |
<a href="#agents" class="text-gray-400 hover:text-white transition">Специалисты</a>
|
| 1075 |
<a href="#about" class="text-gray-400 hover:text-white transition">О компании</a>
|
|
@@ -1549,25 +1549,19 @@
|
|
| 1549 |
showTestimonial(currentTestimonial + 1);
|
| 1550 |
}, 5000);
|
| 1551 |
|
| 1552 |
-
// Reset everything
|
| 1553 |
-
|
| 1554 |
-
e.preventDefault();
|
| 1555 |
-
|
| 1556 |
// Reset search form
|
| 1557 |
document.getElementById('search-form').reset();
|
| 1558 |
|
| 1559 |
-
//
|
| 1560 |
-
document.querySelectorAll('.property-card').forEach(
|
| 1561 |
-
|
| 1562 |
-
card.classList.add('visible');
|
| 1563 |
-
} else {
|
| 1564 |
-
card.classList.remove('visible');
|
| 1565 |
-
}
|
| 1566 |
});
|
| 1567 |
|
| 1568 |
// Reset property pagination
|
| 1569 |
-
visibleCount =
|
| 1570 |
-
loadMoreBtn.style.display = '
|
| 1571 |
closeBtn.classList.add('hidden');
|
| 1572 |
|
| 1573 |
// Reset agents pagination
|
|
@@ -1595,10 +1589,24 @@
|
|
| 1595 |
// Scroll to top
|
| 1596 |
window.scrollTo({
|
| 1597 |
top: 0,
|
| 1598 |
-
behavior: '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1599 |
});
|
| 1600 |
});
|
| 1601 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1602 |
// Smooth scrolling for anchor links
|
| 1603 |
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
| 1604 |
anchor.addEventListener('click', function(e) {
|
|
|
|
| 337 |
<a href="#" id="logo-link" class="text-2xl font-bold gold-text hover:text-yellow-300 transition">Venera Rielt</a>
|
| 338 |
</div>
|
| 339 |
<nav class="hidden md:flex space-x-8">
|
| 340 |
+
<a href="#" id="home-link" class="nav-link text-white hover:text-gold-500 transition">Главная</a>
|
| 341 |
<a href="#properties" class="nav-link text-white hover:text-gold-500 transition">Объекты</a>
|
| 342 |
<a href="#agents" class="nav-link text-white hover:text-gold-500 transition">Специалисты</a>
|
| 343 |
<a href="#about" class="nav-link text-white hover:text-gold-500 transition">О компании</a>
|
|
|
|
| 356 |
<!-- Mobile menu -->
|
| 357 |
<div id="mobile-menu" class="hidden md:hidden glass-effect w-full">
|
| 358 |
<div class="px-2 pt-2 pb-3 space-y-1 sm:px-3">
|
| 359 |
+
<a href="#" id="mobile-home-link" class="block px-3 py-2 text-white hover:bg-gray-800 rounded-md">Главная</a>
|
| 360 |
<a href="#properties" class="block px-3 py-2 text-white hover:bg-gray-800 rounded-md">Объекты</a>
|
| 361 |
<a href="#agents" class="block px-3 py-2 text-white hover:bg-gray-800 rounded-md">Специалисты</a>
|
| 362 |
<a href="#about" class="block px-3 py-2 text-white hover:bg-gray-800 rounded-md">О компании</a>
|
|
|
|
| 1069 |
|
| 1070 |
<div class="mb-6 md:mb-0">
|
| 1071 |
<nav class="flex flex-wrap justify-center gap-4 md:gap-8">
|
| 1072 |
+
<a href="#" id="footer-home-link" class="text-gray-400 hover:text-white transition">Главная</a>
|
| 1073 |
<a href="#properties" class="text-gray-400 hover:text-white transition">Объекты</a>
|
| 1074 |
<a href="#agents" class="text-gray-400 hover:text-white transition">Специалисты</a>
|
| 1075 |
<a href="#about" class="text-gray-400 hover:text-white transition">О компании</a>
|
|
|
|
| 1549 |
showTestimonial(currentTestimonial + 1);
|
| 1550 |
}, 5000);
|
| 1551 |
|
| 1552 |
+
// Reset everything function
|
| 1553 |
+
function resetToInitialState() {
|
|
|
|
|
|
|
| 1554 |
// Reset search form
|
| 1555 |
document.getElementById('search-form').reset();
|
| 1556 |
|
| 1557 |
+
// Show all properties
|
| 1558 |
+
document.querySelectorAll('.property-card').forEach(card => {
|
| 1559 |
+
card.classList.add('visible');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1560 |
});
|
| 1561 |
|
| 1562 |
// Reset property pagination
|
| 1563 |
+
visibleCount = propertyCards.length;
|
| 1564 |
+
loadMoreBtn.style.display = 'none';
|
| 1565 |
closeBtn.classList.add('hidden');
|
| 1566 |
|
| 1567 |
// Reset agents pagination
|
|
|
|
| 1589 |
// Scroll to top
|
| 1590 |
window.scrollTo({
|
| 1591 |
top: 0,
|
| 1592 |
+
behavior: 'instant'
|
| 1593 |
+
});
|
| 1594 |
+
}
|
| 1595 |
+
|
| 1596 |
+
// Reset everything and scroll to top when clicking logo
|
| 1597 |
+
// Add event listeners for home links
|
| 1598 |
+
document.querySelectorAll('#home-link, #mobile-home-link, #footer-home-link').forEach(link => {
|
| 1599 |
+
link.addEventListener('click', function(e) {
|
| 1600 |
+
e.preventDefault();
|
| 1601 |
+
resetToInitialState();
|
| 1602 |
});
|
| 1603 |
});
|
| 1604 |
|
| 1605 |
+
document.getElementById('logo-link').addEventListener('click', function(e) {
|
| 1606 |
+
e.preventDefault();
|
| 1607 |
+
resetToInitialState();
|
| 1608 |
+
});
|
| 1609 |
+
|
| 1610 |
// Smooth scrolling for anchor links
|
| 1611 |
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
| 1612 |
anchor.addEventListener('click', function(e) {
|