Recode jQuery expression in the prototype way

52 views
Skip to first unread message

Moo

unread,
Dec 15, 2011, 2:35:54 PM12/15/11
to Prototype & script.aculo.us
Hi there!

I found a very useful script-snippet for endless scrolling. It loads
new content via AJAX when the page is near the bottom of the page. My
knowledge about JavaScript and Prototype is pretty good actually, but
I always had problems with all the measurement stuff.

Here's the line of code:

var nearBottomOfPage = $(window).scrollTop() > $(document).height() - $
(window).height() - 200;

How could I get that working with Prototype?

Thank you very much!

Message has been deleted
Message has been deleted

buda

unread,
Dec 15, 2011, 11:30:42 PM12/15/11
to prototype-s...@googlegroups.com

function onScroll(e) {
var el = e.element();
if (el.scrollTop >= (el.scrollHeight - (el.clientHeight + 200))) {
//load with ajax some html and append to element
}
}

Brian Williams

unread,
Dec 15, 2011, 11:32:03 PM12/15/11
to prototype-s...@googlegroups.com
oh my carp... dude's, thank you both I love this.



}
}

--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.
To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/4NQ5VfaQV-UJ.

To post to this group, send email to prototype-s...@googlegroups.com.
To unsubscribe from this group, send email to prototype-scripta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply all
Reply to author
Forward
0 new messages