键入@,显示像facebook状态框这样的名单 [英] type @, show a name list like facebook status box

查看:140
本文介绍了键入@,显示像facebook状态框这样的名单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Facebook状态框中,如果您输入@,则会显示朋友姓名列表。我正在尝试实现这样的状态框。

in facebook status box, if you type '@', then a list of friends' names appear. I am trying to implement such a status box.

但问题是:

输入'@' ,'div的位置应该在哪里以及如何显示列表?我无法做出任何改变。

On typing '@', where should the 'div's location be and how to show the list? I just can't make anything out of it.

我经历了

I went through this question of SOF, but that actually does not discuss that.



那里有人尽可能地阐明它吗?

Anybody there to shed light on it as much as possible?

我的选择是jquery。

My choice is jquery.

推荐答案

从Facebook快速浏览一下,似乎有一个< div> 标签,用于在文本内容旁边呈现突出显示的内容。

From a quick glance at facebook, it appears that there is a <div> tag that renders the highlighted content along side the text content.

文本通过< textarea> 元素上的onKeyUp事件一次一键地捕获(透明和覆盖在带有可见内容的div顶部)并转换为< div> 元素。检查按键事件时,只需检查按键是否为@并触发菜单事件。

The text is captured one keystroke at a time by onKeyUp events on the <textarea> element (transparent and overlayed on top of the div with the visible content) and transposed into the <div> element. When examining the key up events, simply check if the key is '@' and fire the menu event.

这篇关于键入@,显示像facebook状态框这样的名单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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