/******/ (() => { // webpackBootstrap /*!************************************************************************!*\ !*** ./resources/js/templates/remax-template/property-tools-mobile.js ***! \************************************************************************/ // Scroll listener and auto-hide logic document.addEventListener('DOMContentLoaded', function () { var btn = document.getElementById('mobileExpandBtn'); var content = document.getElementById('mobileToolsContent'); var container = document.querySelector('.mobile-tools-container'); btn === null || btn === void 0 || btn.addEventListener('click', function () { btn.classList.toggle('expanded'); content.classList.toggle('expanded'); }); btn.addEventListener('click', function () { btn.classList.toggle('expanded'); content.classList.toggle('expanded'); }); var lastScrollY = window.scrollY; var scrollTimer = null; // Optional: Show on load container.classList.add('animate-in'); // Button toggle behavior function toggleMobileTools() { btn.classList.toggle('expanded'); content.classList.toggle('expanded'); } btn.addEventListener('click', toggleMobileTools); // ✅ Scroll listener inside DOMContentLoaded window.addEventListener('scroll', function () { var currentScrollY = window.scrollY; var windowHeight = window.innerHeight; var documentHeight = document.documentElement.scrollHeight; clearTimeout(scrollTimer); var buffer = 2; var atBottom = windowHeight + currentScrollY + buffer >= documentHeight; var scrollingDown = currentScrollY > lastScrollY; if (atBottom) { container.classList.remove('mobile-hide'); container.classList.add('animate-in'); } else { if (scrollingDown && currentScrollY > 100) { container.classList.remove('animate-in'); container.classList.add('mobile-hide'); btn.classList.remove('expanded'); content.classList.remove('expanded'); } scrollTimer = setTimeout(function () { container.classList.remove('mobile-hide'); container.classList.add('animate-in'); }, 1500); if (currentScrollY < 50) { container.classList.remove('mobile-hide'); container.classList.add('animate-in'); } } lastScrollY = currentScrollY; }); }); /******/ })() ;