jQuery get textarea cursor / caret X,Y position and show a DIV underthath [英] jQuery get textarea cursor/caret X,Y position and show a DIV underneath

查看:254
本文介绍了jQuery get textarea cursor / caret X,Y position and show a DIV underthath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Gmail / Google文件Richtext WYSIWYG edtior中实作类似「变更/移除连结」的功能,当您输入网址时,其下方会显示「转到链接,更改,远程」

I am trying to implement something like the "Change/Remove Link" in Gmail/Google Docs richtext WYSIWYG edtior, when you type a URL, a div shows underneath it says "Goto Link, Change, Remote"

我如何使用jQuery编写类似的东西?

How could I write something like that using jQuery?


  1. 如何获取光标的行和列?

  2. 如何计算字体宽度和高度(特别是带有粗体/斜体样式的非固定宽度字体)

  3. 如何确保DIV出现在单词的开头?

提前感谢!

推荐答案

=http://jsfiddle.net/morrison/57BR3/ =nofollow> http://jsfiddle.net/morrison/57BR3/

Answer: http://jsfiddle.net/morrison/57BR3/

功能:


  • 创建位于超链接附近的div。

  • 看起来像Google文档框。

  • 能够更改文字和网址。

  • 删除已实施。

  • Creates div positioned near hyperlink.
  • Looks like Google docs box.
  • Ability to change text and url.
  • Remove is implemented.

不执行的操作:


  • 处理textarea。 Textareas不支持html,因为它们是纯文本。这是一个复杂的过程。找到一个库,然后实现我的答案。

  • 当您的光标移动到arrowkeys时,打开。

这篇关于jQuery get textarea cursor / caret X,Y position and show a DIV underthath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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