Indian Himalayas Itineraries
${tour.name}
${tourtype} ${tour.duration || 0} days from ${tour.price || 0} per person
${tour.excerpt || ""}
View more
No tours available.
"); } if (scrollToTop) { $("html, body").animate({ scrollTop: $("#TourList").offset().top }, 500); } updatePagination(response.pagination); }, error: function (xhr) { console.error("Error fetching tours:", xhr); $("#tour-list-container").empty().append("Failed to fetch tours. Please try again later.
"); }, }); } shouldScroll = true; // Enable scrolling for pagination clicks function updatePagination(pagination) { if (!pagination) { $("#paged").hide(); return; } const currentPage = pagination.current_page; const lastPage = pagination.last_page; const maxVisiblePages = 5; // Number of visible pages before showing "..." $("#paged").empty(); // Add "Previous" button if (currentPage > 1) { $("#paged").append(createPageItem("«", currentPage - 1, false)); } let startPage = Math.max(1, currentPage - Math.floor(maxVisiblePages / 2)); let endPage = Math.min(lastPage, currentPage + Math.floor(maxVisiblePages / 2)); // Always show first page, avoid duplicate if (startPage > 1) { $("#paged").append(createPageItem(1, 1, currentPage === 1)); if (startPage > 2) { $("#paged").append('