Skip to content

Commit

Permalink
Merge pull request protonet#6 from jedhunsaker/namespace
Browse files Browse the repository at this point in the history
Namespace events, expose checkInView function
  • Loading branch information
zuk committed Jul 24, 2013
2 parents 313fe2e + 22f37e4 commit 9b43237
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions jquery.inview.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@
}
}

function triggerInViewChecker() {
shouldCheckInView = true;
}
var $win = $(window);

$(window).scroll(triggerInViewChecker);
$(window).resize(triggerInViewChecker);
$(window).click(triggerInViewChecker);
// kick the event to pick up any elements already in view.
// ready.inview kicks the event to pick up any elements already in view.
// note however, this only works if the plugin is included after the elements are bound to 'inview'
$(window).ready(triggerInViewChecker);
// you can call it manually in your application by calling $(window).trigger('checkInView');
$win.on('checkInView.inview click.inview ready.inview', check_inview);

$win.on('scroll.inview resize.inview', function() {
shouldCheckInView = true;
});

// Source: http://ejohn.org/blog/learning-from-twitter/
setInterval(function() {
Expand Down

0 comments on commit 9b43237

Please sign in to comment.