Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Checking visibility
- jQuery.fn.isScrolledIntoView = function () {
- var thisOffset = $(this).offset().top;
- var windowHeight = $(window).height();
- var heightToThis = thisOffset - windowHeight;
- var scrollPosition = $(window).scrollTop();
- if ( (scrollPosition >= heightToThis ) ) {
- return true;
- }
- }
- // Timer on scroll
- $(window).scroll(function(){
- // Resize actions are in handleScroll()
- if (scrollTimer) {
- clearTimeout(scrollTimer); // clear any previous pending timer
- }
- scrollTimer = setTimeout(handleScroll, 1); // set new timer
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement