Jquery捲軸監聽
const scrollContainer = document.getElementById('ticket-records'); scrollContainer.addEventListener('scroll', () => { if (scrollContainer.scrollHeight - scrollContainer.scrollTop === scrollContainer.clientHeight) { console.log('捲軸到達底部!'); // 在這裡執行到達底部時的操作 } if (scrollContainer.scrollTop === 0) { console.log('捲軸到達頂部!'); //獲取聊天曆史訊息 } })