This article mainly brings you an example to explain the event triggered when the scroll bar slides to the bottom. Has very good reference value. Let’s follow the editor and take a look. I hope it will be helpful to everyone. I hope it can help everyone.
The example is as follows:
$(document).on("scroll", function () { //真实内容的高度 var pageHeight = Math.max(document.body.scrollHeight, document.body.offsetHeight); //视窗的高度 var viewportHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0; //隐藏的高度 var scrollHeight = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; //判断加载视频,文章,回答,医生 if(pageHeight - viewportHeight - scrollHeight <=0){ //事件 } });
Related recommendations:
jquery Enter key trigger event implementation method
How does js trigger an event after the mouse hovers for a certain period of time
jquery: solution to the problem of delegate repeatedly triggering events
The above is the detailed content of Determine when the scroll bar slides to the bottom and trigger an event instance sharing. For more information, please follow other related articles on the PHP Chinese website!