Sunday 15 February 2015

jquery - AJAX Chat - Automatically drag the scroll down, but don't drag it when the user is scrolling up? -


You know how this goes down to the most chats, when a new message appears, my chat every 5000 MS reloads, and then scrolls down to 300ms.

But I want to create it, so when the user leaves scroll-up, drag the scroll will not affect it after scrolling the user, if filling a function such as to fill a variable , DraggedScroll = true?

This is the conversation, and as you see, if you go up, then you drag down every 5000ms, and I only stop it when the user scrolls up And if the user scrolls down [0] again, it will be dragged Scroll = false, so it will affect it again.

How do I do this?

The problem has not been solved!

Explanation of the problem:

This book only works if at least 1500px ( scrolltop (1500) ) (34 messages in chat).

If it is below, scroll will not work, and will scroll to new message.

reload function () {var oldscrollHeight = ($ ("# chat") ScrollTop () + 470); Console.log ("old:" + old scolite); $ .post ("ajax.php", {loadMessages: "1"}, function (data) {$ ("discussion."). Html (data); var newcomputer = $ ("chat #"). Prop (" ("New:" + newscrollHeight); if (newslowhite & lt; (oldcoollight + 150)) {var height = $ ('# chat') [0] .scrollHeight; $ ('# chat') .scrollTop (height) Actually what I did there, I took the current position of the scroll and added 470 px for it (since it will always be less than the full height). < / P>

And then check if the new height is

if yes Scroll down or else stay in one place.

No comments:

Post a Comment