control scroll of div

24 views
Skip to first unread message

Viktor Dušenka

unread,
Apr 8, 2014, 6:36:27 AM4/8/14
to enf...@googlegroups.com
hello is the any option how to controll corrent height of scrollbar in selected div ?
something like:
if is scrolling div[id=ctnt] ?
 control if pageYOffset is min?
   do action

ckirkendall

unread,
Apr 8, 2014, 9:19:23 AM4/8/14
to enf...@googlegroups.com
Can you give me a better idea on what you are trying to do.  There are ways to listen for scroll events and trigger actions but without more information I am not sure exactly how to help.

Creighton

Viktor Dušenka

unread,
Apr 8, 2014, 10:27:31 AM4/8/14
to enf...@googlegroups.com
idea is to load new message when i reach with scrollbar the top of div where are loaded messages

ckirkendall

unread,
Apr 9, 2014, 2:45:07 PM4/9/14
to enf...@googlegroups.com
This is actually a fairly hard problem.  The easiest way is to use elementFromPoint (https://developer.mozilla.org/en-US/docs/Web/API/document.elementFromPoint).  Pick a point just inside the top corner of the div.  Check to see if the top element in the div is returned by this check.  You would need to fire the check on the event type :scroll.  Hope that helps.

CK

Viktor Dušenka

unread,
Apr 16, 2014, 5:00:11 AM4/16/14
to enf...@googlegroups.com
Thanks a much. I will try it, how it works and i'm sorry for late answer

Reply all
Reply to author
Forward
0 new messages