Spaces:
Running

DISSASTER commited on
Commit
c327bee
·
verified ·
1 Parent(s): 6899199

Сделай пожалуйста чтобы если список карточек объектов заканчивалась, появлялась кнопку "закрыть" со стрелочкой вверх и они закрывались до первых 5 - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +20 -1
index.html CHANGED
@@ -739,6 +739,9 @@
739
  <button id="load-more-btn" class="gold-bg text-black font-bold py-3 px-8 rounded-lg btn-gold hover:bg-yellow-600 transition duration-300">
740
  Показать ещё <i class="fas fa-chevron-down ml-2"></i>
741
  </button>
 
 
 
742
  </div>
743
  </div>
744
  </section>
@@ -1586,6 +1589,7 @@
1586
  // Property pagination
1587
  const propertyCards = document.querySelectorAll('.property-card');
1588
  const loadMoreBtn = document.getElementById('load-more-btn');
 
1589
  let visibleCount = 0;
1590
  const itemsPerPage = 5;
1591
 
@@ -1599,15 +1603,30 @@
1599
  visibleCount = nextItems;
1600
 
1601
  if (visibleCount >= propertyCards.length) {
1602
- loadMoreBtn.style.display = 'none';
 
1603
  }
1604
  }
1605
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1606
  // Initialize - show first 5 properties
1607
  showNextProperties();
1608
 
1609
  // Load more on button click
1610
  loadMoreBtn.addEventListener('click', showNextProperties);
 
1611
 
1612
  // Animation on scroll
1613
  const animatedElements = document.querySelectorAll('.slide-up, .fade-in');
 
739
  <button id="load-more-btn" class="gold-bg text-black font-bold py-3 px-8 rounded-lg btn-gold hover:bg-yellow-600 transition duration-300">
740
  Показать ещё <i class="fas fa-chevron-down ml-2"></i>
741
  </button>
742
+ <button id="close-btn" class="hidden btn-close text-white font-bold py-3 px-8 rounded-lg hover:bg-gray-800 transition duration-300">
743
+ Закрыть <i class="fas fa-chevron-up ml-2"></i>
744
+ </button>
745
  </div>
746
  </div>
747
  </section>
 
1589
  // Property pagination
1590
  const propertyCards = document.querySelectorAll('.property-card');
1591
  const loadMoreBtn = document.getElementById('load-more-btn');
1592
+ const closeBtn = document.getElementById('close-btn');
1593
  let visibleCount = 0;
1594
  const itemsPerPage = 5;
1595
 
 
1603
  visibleCount = nextItems;
1604
 
1605
  if (visibleCount >= propertyCards.length) {
1606
+ loadMoreBtn.classList.add('hidden');
1607
+ closeBtn.classList.remove('hidden');
1608
  }
1609
  }
1610
 
1611
+ function closeProperties() {
1612
+ // Hide all properties except first 5
1613
+ propertyCards.forEach((card, index) => {
1614
+ if (index >= itemsPerPage) {
1615
+ card.classList.remove('visible');
1616
+ }
1617
+ });
1618
+
1619
+ visibleCount = itemsPerPage;
1620
+ closeBtn.classList.add('hidden');
1621
+ loadMoreBtn.classList.remove('hidden');
1622
+ }
1623
+
1624
  // Initialize - show first 5 properties
1625
  showNextProperties();
1626
 
1627
  // Load more on button click
1628
  loadMoreBtn.addEventListener('click', showNextProperties);
1629
+ closeBtn.addEventListener('click', closeProperties);
1630
 
1631
  // Animation on scroll
1632
  const animatedElements = document.querySelectorAll('.slide-up, .fade-in');