如何在自定义无限滚动上显示在页脚上加载gif

时间:2014-05-16 19:18:44

标签: javascript jquery gif infinite-scroll

我想知道是否可以在这个自定义jquery上显示加载gif。

我只是想在每个向下滚动时在页脚上显示一个gif,就像无限滚动一样。

http://jsfiddle.net/barrycorrigan/4Ur6R/

jQuery(function() {

/**
    * Reveal Sections as the users scrolls - Development Ongoing
    * Get the nth div of class content, where n is the contentNumber, and make it shown
    * Set intital divs to be hidden
*/

jQuery(".mine").addClass("noshow");
var contentNumber = 0;

function reveal() {
    var constraintNumber = contentNumber + 12;
    //IMPORTANT - DO NOT DELETE
    jQuery(window).trigger('resize');
    //IMPORTANT - DO NOT DELETE
    for (i = contentNumber; i < constraintNumber; i++) {
        //Get the nth div of class content, where n is the contentNumber, and make it shown
        jQuery('.mine').eq(contentNumber).removeClass("noshow");
        contentNumber ++;
    }
}

//Window scroll function
jQuery(window).scroll(function() {
   if (jQuery(window).scrollTop() >= jQuery(document).height() - jQuery(window).height() - 800) 
    {
        reveal();
    }
});
reveal();

});

0 个答案:

没有答案