简体   繁体   English

如何仅在没有jquery的情况下开始向下滚动角度时如何显示滚动到顶部按钮

[英]How to make scroll to top button appear only when you have started scrolling down in angular without jquery

I'm trying to do it using a custom directive for that element and manipulate in the link function but I don't know how to proceed. 我正在尝试使用该元素的自定义指令并在链接函数中进行操作,但我不知道如何进行。 Can we do it using pure javascript or any other library except jquery since people say 'no jquery in angular apps please' for some reason. 我们可以使用纯JavaScript还是jquery以外的任何其他库来做到这一点,因为人们出于某种原因说“请在角度应用程序中不要jquery”。

Found out Javascript has some inbuilt functions like .onscroll, .scrollY, .scroll which can be used to achieve the aforementioned functionality. 发现Javascript具有一些内置函数,例如.onscroll,.scrollY,.scroll,可用于实现上述功能。 I think a search into javascript in-built functions will get most of the stuff done before moving onto jquery. 我认为,对javascript内置函数的搜索将在转移到jquery之前完成大部分工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM