tags:

views:

20

answers:

0

hello everyone,

i write a messagesystem for a community, so imagine you have hundreds of items in a list. My idea was to load first of all 20 messages and while the user scrolls the next 20 messages.

i use the following code to load content while scrolling

$(window).scroll(function(){
        if  ($(window).scrollTop() == $(document).height() - $(window).height()){
           //do something
        }
}); 

Up to here everything works fine, but I want to add a delete function, which deletes a message via ajax and removes the item from the list. When a message was deleted, the scroll function does not longer work, I think there is a problem with the changed height. As a fact of this, I try to change the code:

$(window).live("scroll", function(){
}); 

As you can read the docs of jquery, live() currently not supported "scroll".

Now the question: is there a possibility, to make this work? I think about a "dirty" solution to subtract the height of the message item from window height - but I hope, there is a better way...