Created
April 1, 2011 19:25
-
-
Save jpurcell/898695 to your computer and use it in GitHub Desktop.
Fire on scroll direction change.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var scrollingUp = false; | |
var prevIndex = 1; | |
Ti.API.debug('init: scrolling down'); | |
tableView.scrollToIndex(1); | |
tableView.addEventListener('scroll',function(e){ | |
Ti.API.debug('prev '+prevIndex+', curr '+e.firstVisibleItem+', scrollingUp '+scrollingUp); | |
if (prevIndex > e.firstVisibleItem) { | |
if (!scrollingUp) { | |
Ti.API.debug('scrolling up'); | |
scrollingUp = true; | |
} | |
} else if(prevIndex < e.firstVisibleItem) { | |
if (scrollingUp) { | |
Ti.API.debug('scrolling down'); | |
scrollingUp = false; | |
} | |
} | |
prevIndex = e.firstVisibleItem; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment