scroll down up js
var lastScrollTop = 0;
// element should be replaced with the actual target element on which you have applied scroll, use window in case of no target element.
element.addEventListener("scroll", function(){ // or window.addEventListener("scroll"....
var st = window.pageYOffset || document.documentElement.scrollTop; // Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
if (st > lastScrollTop){
// downscroll code
} else {
// upscroll code
}
lastScrollTop = st <= 0 ? 0 : st; // For Mobile or negative scrolling
}, false);
Also in JavaScript:
- discord bot javascript remove user data in array
- sum all fields in nested json logstash
- jquery attribute selector
- define two variables in one line javascript
- refresh current component angular
- javascript canvas 1px line
- javascript lowercase string
- javascript truncate string full word
- https request node.js output incomplete
- Caesars Cipher javascript
- 0.1 + 0.2 javascript
- cannot get / angular
- json decode android
- How many different types of JS alerts do we have?
- how to call a function in react with arguments onclick
- copy text on button click in jquery
- javascript array last element
- prevent form submission on onsubmit function calls
- jquery is not defined rails
- listar objetos javascript
- javascript get values from object
- javascript generate unique id
- ajouter javascript dans html
- get parent element using jquery