📌  相关文章
📜  基于滚动位置并获取数据属性的javascript代码示例

📅  最后修改于: 2022-03-11 15:03:39.697000             🧑  作者: Mango

代码示例1
@HostListener('scroll', ['$event']) onScroll(event: any, indexI ?) { let els = document.getElementsByTagName("li"); let offsetHeight = event.target['offsetHeight']; let scrollTop = event.target['scrollTop']; let scrollHeight = event.target['scrollHeight']; this.getImageById(id); } getImageById(id){ this.apiService.getimageData(id).subscribe(images => this.images = images); }