Spaces:
Running

DISSASTER commited on
Commit
42e3da3
·
verified ·
1 Parent(s): ff31622

После того как нажимаешь на Venera rielt с шапки или кнопки главная, при раскрытии больше карт, кнопка "показать ещё" зависает и остаётся на экране, исправь пожалуйста - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +13 -3
index.html CHANGED
@@ -1838,18 +1838,25 @@
1838
  document.getElementById('search-form').reset();
1839
 
1840
  // Reset property visibility and pagination
 
1841
  document.querySelectorAll('.property-card').forEach((card, index) => {
1842
- if (index < 5) {
1843
  card.classList.add('visible');
1844
  } else {
1845
  card.classList.remove('visible');
1846
  }
1847
  });
1848
 
1849
- visibleCount = 5;
1850
- loadMoreBtn.style.display = 'inline-flex';
1851
  closeBtn.classList.add('hidden');
1852
 
 
 
 
 
 
 
 
1853
  // Reset agents pagination
1854
  agentCards.forEach((card, index) => {
1855
  if (index >= agentsPerPage) {
@@ -1982,12 +1989,15 @@
1982
 
1983
  visibleCount = nextItems;
1984
 
 
1985
  if (visibleCount >= propertyCards.length) {
1986
  loadMoreBtn.classList.add('hidden');
 
1987
  } else {
1988
  loadMoreBtn.classList.remove('hidden');
1989
  }
1990
 
 
1991
  if (visibleCount > (window.innerWidth < 768 ? 5 : 6)) {
1992
  closeBtn.classList.remove('hidden');
1993
  }
 
1838
  document.getElementById('search-form').reset();
1839
 
1840
  // Reset property visibility and pagination
1841
+ const initialCount = window.innerWidth < 768 ? 5 : 6;
1842
  document.querySelectorAll('.property-card').forEach((card, index) => {
1843
+ if (index < initialCount) {
1844
  card.classList.add('visible');
1845
  } else {
1846
  card.classList.remove('visible');
1847
  }
1848
  });
1849
 
1850
+ visibleCount = initialCount;
 
1851
  closeBtn.classList.add('hidden');
1852
 
1853
+ // Show or hide load more button based on total properties
1854
+ if (document.querySelectorAll('.property-card').length <= initialCount) {
1855
+ loadMoreBtn.classList.add('hidden');
1856
+ } else {
1857
+ loadMoreBtn.classList.remove('hidden');
1858
+ }
1859
+
1860
  // Reset agents pagination
1861
  agentCards.forEach((card, index) => {
1862
  if (index >= agentsPerPage) {
 
1989
 
1990
  visibleCount = nextItems;
1991
 
1992
+ // Hide "Load More" button when all properties are shown
1993
  if (visibleCount >= propertyCards.length) {
1994
  loadMoreBtn.classList.add('hidden');
1995
+ closeBtn.classList.remove('hidden');
1996
  } else {
1997
  loadMoreBtn.classList.remove('hidden');
1998
  }
1999
 
2000
+ // Show close button when more than initial batch is visible
2001
  if (visibleCount > (window.innerWidth < 768 ? 5 : 6)) {
2002
  closeBtn.classList.remove('hidden');
2003
  }