[Proto-Scripty] Re: Bottomless scroll

2011-05-24 Thread kstubs
I have something working, but seems that the fetch routine is firing too 
soon, so I wonder if I'm using viewportOffset and getScrollOffset 
incorrectly.

var item = this.layer.select('div.content_item').last();
var vp_top = item.viewportOffset()['top'];
var item_top = document.viewport.getScrollOffsets()['top'];
if(item_top > vp_top) {
   ... fetch more data ...
}

So above, item represents the last item from the list of results on the page 
and vp_top is of course the viewportOffset value.I'm expecting that the item 
top value is less than the viewportOffset top value until it has scrolled 
into view.  Instead, the ... fetch more data ... code is firing well before 
the layer comes into view.

Thanks for any help.

Karl..

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: Bottomless scroll

2011-05-24 Thread Julien Lenne
Hello,

You could take a look at scrollTop and scrollHeight attributes maybe.
Details here : http://www.w3schools.com/jsref/dom_obj_all.asp

Regards,
Julien.

On May 24, 7:57 am, kstubs  wrote:
> Any ideas how to implement a bottomless scroll?  I have an events page,
> dates descending from today to the past.  On initial load you show 1 month
> worth of events.  As the user scrolls down, I will load more events.  So I
> guess I hook into windows scroll event, and then what?  How would I
> determine that the page is scrolled to the bottom?  I guess I have a known
> set of objects drawn to the page, and I suppose I know the last object in
> the list on the page; so do I trigger a look up when this layer becomes
> visible?  So, wonder how that is done...
>
> Karl..

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.