I'm trying to do something with javascript to let my chat behave a little better than how it does now.
Since I use PrimeFaces' poll to update the panel and simulate the chat, the panel gets updated each second, making really hard to read an old message (updating the panel causes the scroll to be reset at the top of the panel).
So I've added an onscroll
event to the div
, to stop polling when the user is scrolling.
But I need a way to make it restart, so I've thought of something like putting a timer and recall the poll.start()
a minute after the stop of the scrolling.
Is there any way to do that?