我正在尝试在textarea中使用highlighter.js。我已经修改了their example,并用pre包装的textarea替换了p (用于双向设置)。
<div class="article" style="width: 80%; height: 80%;">
<pre style="width: 100%; height: 100%;">
<textarea style="width: 100%; height: 100%;">Highlight some body text!
This is a jQuery plugin that allows you to display a pop-up tooltip when a user highlights text. This can be useful in a variety
of situations, and there didn't seem to be a good open source solution before this.
on how to implement this on your website. It's very easy!
</textarea>
</pre>
</div>当我突出显示一个单词时,无论单词的位置如何,工具提示都会在错误的位置弹出,即textarea的左下角。我该如何修复它?
发布于 2015-12-28 14:54:07
这对我来说在Firefox和Chrome上都行得通。您使用的是哪种浏览器。它捕捉到突出显示区域中的最后一个单词。如果我突出显示一个单词,它就会捕捉到该单词。希望这能有所帮助。
https://stackoverflow.com/questions/34488790
复制相似问题