我正试图在textarea
中使用highlighter.js。我修改了他们的示例,用pre
包装的textarea
替换了p
(用于bidi设置)。
<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
的左下角。我该如何修复它?
这在Firefox和Chrome中对我有效。你在用什么浏览器。它在突出显示的区域中紧跟最后一个单词。如果我突出显示一个单词,它就会直接指向那个单词。希望这能有所帮助。