Get the App
SLTechnology News&Howtos  ›  Development  › 

How does vue monitor how the page scrolls to a certain height to trigger events

Shulou Source: shulou.com Published: 2022-05-31 20:03:51 11月14日 Update

This article mainly explains "how vue monitors the page to scroll to a certain highly triggered event." Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "how vue monitors the page to scroll to a certain height trigger event"!

Scrolling to a high trigger event methods: { showIcon() { if ( !! document.documentElement.scrollTop && document.documentElement.scrollTop > 200 ) { Page height greater than 200 Perform operation } else { Page height is less than 200 } },}

surveillance incident

mounted() { window.addEventListener("scroll", this.showIcon);}, dynamically listen to page scroll height//get page scroll height methods:{ scrollHandle(e){ let top = e.srcElement.scrollingElement.scrollTop; //Get page scroll height console.log(top); }}mounted(){ window.addEventListener ('scroll ',this.scrollHandle);//bind page scroll events }, At this point, I believe that everyone has a deeper understanding of "how vue monitors page scrolling to a certain height trigger event", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Tags: Page height event monitoring content learning practical deeper interest dynamic practical practical easy to operate method more friends website channel query Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Shulou Technology Shulou Tech Info Huawei Xiaomi