简体   繁体   English

在jquery中的Stack溢出样式标记系统

[英]Stack Overflow style tagging system in jquery

I am wondering if there is a prebuilt clone (or very similar) to the Stack Overflow tagging system. 我想知道是否有一个预先构建的克隆(或非常相似)Stack Overflow标记系统。

I have done some Googling however cannot find any powered by jquery. 我做了一些谷歌搜索,但找不到任何由jquery驱动。

Here is my implementation (which I think is much more true to the SO style than is the accepted answer). 这是我的实现(我认为SO风格比接受的答案更为真实)。 The style may need tweaking but it's functionally the same as you see on SO. 风格可能需要调整,但它在功能上与你在SO上看到的相同。

Features: 特征:

  • Takes a predefined input field with words separated by commas -- perfect for all cases such as those in which you are editing an item that already has tags -- and builds the interactive tag editor from this information. 采用带逗号分隔的单词的预定义输入字段 - 适用于所有情况,例如您正在编辑已有标记的项目的情况 - 并根据此信息构建交互式标记编辑器。

    example in rails format: rails格式的示例:

      <input id="post_tag_list" name="post[tag_list]" value='testing, test, probably, goose, under_score'/> 
  • Updates a hidden input field as the user edits tags so that the submitted form will have all desired tags. 当用户编辑标签时更新隐藏的输入字段,以便提交的表单将具有所有所需的标签。

  • Deleting backwards through the (fake) tag input field is functionally the same as deleting one long string of words, making editing more natural. 通过(假)标签输入字段向后删除在功能上与删除一个长字符串相同,使编辑更自然。

  • Tags can be clicked on to edit. 可以单击标签进行编辑。

  • Commas, spaces, returns, and tabs close an open tag that is being edited or created. 逗号,空格,返回和制表符关闭正在编辑或创建的打开标记。

  • Close button on tags functions as expected. 标签上的关闭按钮按预期运行。

  • etc. 等等

Find it here: http://jsfiddle.net/bradleygriffith/axjKm/ 在这里找到它: http//jsfiddle.net/bradleygriffith/axjKm/

I ended up building my own implementation: 我最终构建了自己的实现:

http://webspirited.com/tagit/index.php?themeroller=true#demo8 http://webspirited.com/tagit/index.php?themeroller=true#demo8

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

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