How to determine the page slid to the bottom of the screen
Projects often encounter List page, in order to ensure the user experience, our technology will be used on the LAC uploaded, keeping the user experience, how to determine the page slid to the bottom of the screen is a more critical step: realization:
mounted in the monitor:
mounted () { window.addEventListener ( ' the Scroll ' , the this .scroll, false ) // Listener (binding) wheel scroll event },
methods declared in the method:
scroll () { the clientHeight the let = || document.documentElement.clientHeight document.body.clientHeight // Equipment / height of the screen the let scrollObj = document.querySelector ( ' #surface ' ) // scroll region let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop scrollHeight the let = scrollObj.scrollHeight // scrollbar overall height IF (== scrollHeight the clientHeight scrollTop +) { // div + distance to the head height of the screen can be scrolled = overall height // When the page to slide into the bottommost screen do operations } },