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;
});
More Related Contents:
- Regular Expression jquery validation1 [duplicate]
- Can’t append element
- jQuery how to bind onclick event to dynamically added HTML element [duplicate]
- No ‘Access-Control-Allow-Origin’ header is present on the requested resource error
- How do I create a link using javascript?
- Getting Error “Form submission canceled because the form is not connected”
- Parsing CSS in JavaScript / jQuery
- How do I catch jQuery $.getJSON (or $.ajax with datatype set to ‘jsonp’) error when using JSONP?
- Generate unique number within range (0 – X), keeping a history to prevent duplicates
- How to open a file / browse dialog using javascript?
- Ajax success event not working
- CSS media queries and jQuery window .width() do not match
- Why does appending a to a dynamically created seem to run the script in the parent page?
- Rotate image with javascript
- Responsive horizontal page sliding
- How can I toggle the element that is clicked and hide all others?
- Embed HTML5 YouTube video without iframe?
- jQuery validate plugin on DIV
- jQuery call function from a string [duplicate]
- how to resolve iframe cross domain issue [duplicate]
- how to get selection inside a div using jquery/javascript
- Storing a variable in the JavaScript ‘window’ object is a proper way to use that object?
- Uncaught ReferenceError: $ is not defined error in jQuery
- Get Correct keyCode for keypad(numpad) keys
- How can I stop jQuery.ajax() from logging failures to the console?
- Why does the jQuery JSON parser need double escaping for backslashes?
- Dealing with overlapping jQuery sortable lists
- Is there any way to check reachability test of server in jQuery
- Generate XML document in-memory with JavaScript
- parse xml response with jQuery