简体   繁体   English

jQuery-Facebook标签

[英]jquery - Facebook tagging

Is there a plugin that has similar behavoir like the Facebook tagging? 是否有具有类似Facebook标记的行为的插件?

Whats so special about this, is that it features: 它的特别之处在于它具有以下特点:

  • Autocomplete in between typed words 在键入的单词之间自动完成
  • Special outputted html (which is synced with another input field) 特殊输出的html(与另一个输入字段同步)

标记示例

you can use jquery mention inputs plugin its similar to facebook mentions 您可以使用jQuery提及输入插件,其类似于Facebook提及

or you can use jquery sew plugin 或者你可以使用jQuery缝插件

You can use the JQuery UI widget : which allows you to create a list of special words which will suggest + autocomplete te word when the user starts typing it. 您可以使用JQuery UI 小部件 :它允许您创建特殊单词的列表,当用户开始输入时将建议+自动填充单词。

You can handle the special formatted html by using the callback when a special word is chosen: 选择特殊字词后,您可以通过使用回调来处理特殊格式的html:

$( ".selector" ).autocomplete({
select: function( event, ui ) {}
});

Added: 添加:
It's also possible to trigger it in the middle of a sentence, I did found an example on JSfiddle which allows you to do this. 也可以在句子的中间触发它,我确实在JSfiddle上找到了一个示例,您可以执行此操作。

Press the @ anywhere in the sentence and type the first letter. 在句子中的任意位置按@ ,然后输入第一个字母。 You can change the select callback if you want some custom html arround it. 如果需要一些自定义html环​​绕,可以更改select回调。

http://jsfiddle.net/UdUrk/ http://jsfiddle.net/UdUrk/

Hope this brings you closer to the solution. 希望这能使您更接近解决方案。

Kevin 凯文

I'm glad you were able to find a solution that seems to fit your needs, OP. 很高兴您能找到一个适合您需求的解决方案,OP。 For anyone else who happens to stumble upon this (and OP if my assumption was wrong) who is looking for a robust, actively-maintained solution... 对于碰巧偶然发现此问题的其他人(如果我的假设是错误的,则是OP),他们正在寻找一种功能强大且积极维护的解决方案...

...check out Mentionator : it is a jQuery plug-in which enables clients to create highlighted references to ("mentions") to predefined entities in text areas. ...签出Mentionator :这是一个jQuery插件,使客户端可以创建对文本区域中预定义实体的(“提及”)突出显示的引用。 It is mantained by this guy right here :) . 它是由这个家伙在这里维护的:)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM