简体   繁体   中英

How to use scroll in javascript without using jquery?

How to add scroll in JavaScript without using jquery? I just want to add scroll effect on a div without using jquery to make the code efficient.

这是你的答案

document.queryselector("#btn").addEventListener("onscroll", displayDiv);

I searched and found another way to call it object.onscroll = function(){myScript}; and it also worked

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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