Permalink
Browse files

Fixed a bug where the callback fires when the inner wrap hasn't been …

…created.
  • Loading branch information...
fredwu committed Jun 18, 2010
1 parent 5938e40 commit c609596e954f92969bb998545fd37a47624619a2
Showing with 7 additions and 4 deletions.
  1. +7 −4 jquery.endless-scroll.js
View
@@ -1,7 +1,7 @@
/**
* Endless Scroll plugin for jQuery
*
- * v1.4
+ * v1.4.1
*
* Copyright (c) 2008 Fred Wu
*
@@ -76,13 +76,16 @@
if (firing === true)
{
$(this).scroll(function(){
+ // calculates the actual height of the scrolling container
var inner_wrap = $(".endless_scroll_inner_wrap", this);
-
if (inner_wrap.length == 0) {
$(this).wrapInner("<div class=\"endless_scroll_inner_wrap\" />");
}
-
- if (inner_wrap.height() - $(this).height() <= $(this).scrollTop() + options.bottomPixels)
+
+ if (
+ inner_wrap.length > 0 &&
+ (inner_wrap.height() - $(this).height() <= $(this).scrollTop() + options.bottomPixels)
+ )
{
if ((options.fireOnce == false || (options.fireOnce == true && fired != true)))
{

0 comments on commit c609596

Please sign in to comment.