Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery check scroll direction

let scrollDirection = '';
let scrollTopPosition = 0;
$(window).on('scroll', function() {
	if(scrollTopPosition > $(window).scrollTop()) {
		scrollDirection = 'to-top';
	} else {
		scrollDirection = 'to-bottom';
	}
	
	scrollTopPosition = $(window).scrollTop();
});

console.log(scrollDirection);
Comment

PREVIOUS NEXT
Code Example
Javascript :: oncheck event jquery 
Javascript :: uppercase javascript 
Javascript :: jquery check a radio button 
Javascript :: javascript close window after print 
Javascript :: javascript add attribute 
Javascript :: js alert and redirect 
Javascript :: 419 unknown status ajax laravel 
Javascript :: js wait sleep 
Javascript :: angular pipe capitalize 
Javascript :: javascript date minus seconds 
Javascript :: js how to shufle elements in array 
Javascript :: python convert requests response to json 
Javascript :: google script for loop 
Javascript :: styling scrollview height in react native 
Javascript :: react js usehistory push and pass props 
Javascript :: uninstall node js from mac 
Javascript :: timeout javascript 
Javascript :: @types react-router-dom 
Javascript :: nodejs get file size 
Javascript :: count items in div jquery 
Javascript :: jquery smooth scrool 
Javascript :: javascript get month name 
Javascript :: document.ready 
Javascript :: write in utf8 fs 
Javascript :: Failed to transform react-native-reanimated-65.aar 
Javascript :: disable click event jquery 
Javascript :: jquery json decode 
Javascript :: js append element to body 
Javascript :: javascript change string at particular index 
Javascript :: react font awesome delete icon 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =