“用户正在输入消息”功能...? [英] 'User is typing a message' function...?

查看:127
本文介绍了“用户正在输入消息”功能...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想指出,我指的是聊天,你在底部看到写在PHP / jQuery的系统的用户正在输入消息......我已经尝试了许多方法来完成,但都失败了,我建立了自己的聊天系统编写PHP + MySQL的/阿贾克斯+ jQuery的。

Just to point out I'm referring to chat systems written in PHP/jQuery where you see at the bottom 'User is typing a message...' I've tried so many methods to accomplish it but all fail, I built my own chat system written in PHP + MySQL/Ajax + jQuery.

我不要求别人写的功能,我只是给我一个小例子,所以我可以做什么的想法。

I'm not asking for someone to write the function for me but just to give me a little example so I can get an idea of what to do.

我将不胜AP preciate它,在此先感谢:)

I would greatly appreciate it, thanks in advance :)

推荐答案

使用计时器来发送一个AJAX请求的onkeyup ,告诉用户输入数据库,对另一面,当你拉下来聊天消息,你就可以通知他们键入其他人。

Use a timer to send an AJAX request onkeyup that tells the database the user is typing, on the other side when your pulling down chat messages you can then notify the other person that they are typing.

看看doTimeOut具有防抖动在JavaScript中的一个很好的例子......

Take a look at doTimeOut which has a great example of debouncing in javascript...

http://benalman.com/$c$c /项目/ jQuery的-dotimeout /例子/去抖/

这篇关于“用户正在输入消息”功能...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆