0

I have this piece of code and the 'view more' buttom gets initiated only when the mouse hovers over it, but I want to initiate the 'view more' button when at the end of the page. Any help on this how to do this?

    this.$viewMore.find('input.ow_newsfeed_view_more').hover(function(){
    var btn = this;
    OW.inProgressNode(this);
    self.loadMore(function(){
        OW.activateNode(btn);
        if ( self.totalItems > self.actionsCount)
        {
            self.$viewMore.show();
        }
    });
});

I know that it could be done using this piece of code, but I couldn't do it. Here, the alert('bottom!') works fine, but the 'view more' doesn't gets to initiate.

$(document).ready(function() {
$(window).scroll(function() {
    if($(window).scrollTop() + $(window).height() == $(document).height()) {
        alert("bottom!");
    }
});

});

Nirmalya Ghosh
  • 2,298
  • 3
  • 18
  • 33

1 Answers1

0

The jQuery Waypoint plugin is pretty well used. Using it might spare you the nightmare of dealing with different quirks across devices / browsers.

Wayne Whitty
  • 19,513
  • 7
  • 44
  • 66