如何在Angular中获取clientHeight?

时间:2019-01-25 15:34:41

标签: javascript angular

我在滚动页面时试图获得客户身高:

@HostListener('window:scroll', ['$event']) onScrollEvent($event) {
   if ($event.scrollHeight - $event.scrollTop === $event.clientHeight) {
    console.log('scrolled to the end');
  }
});

我需要检测用户是否滚动到页面末尾

2 个答案:

答案 0 :(得分:2)

我认为您可以这样做(see this post for other solutionsand this article for this solution):

ShowWindow (hWnd, nCmdShow);
  

请参见Stackblitz demo here

答案 1 :(得分:1)

要获取高度:

 var height = $window.innerHeight;