jquery on scroll
Check current scrollTop vs previous scrollTop
var lastScrollTop = 0;
$(window).scroll(function(event){
var st = $(this).scrollTop();
if (st > lastScrollTop){
// downscroll code
} else {
// upscroll code
}
lastScrollTop = st;
});$("#main-div" ).on( 'wheel', function() {
alert("Hello! I am an alert box!!");
});Syntax
Trigger the scroll event for the selected elements:
$(selector).scroll()
Attach a function to the scroll event:
$(selector).scroll(function)
Also in JavaScript:
- .pop js
- javascript style
- json in listview flutter
- javascript iterate through object
- jquery get element id
- vue js access data in method
- elements under p5 canvas
- draw line between two div css
- js html textarea tag access
- onclick on non button
- how to store and delete s3 image using node js
- jquery on scroll
- nextjs starter template with auth
- filter out arrays js
- nodejs express routing
- javascript array find highest value of array of objects by key
- html form not submit on enter
- open json file r
- callout react
- javascript push array
- javascript iterate object
- js document ready
- rock paper scissors javascript
- urlencoded json express