搜索关键词高亮,搜索高亮,关键字高亮,highlight
基于Jquery,所以使用之前要导入Jquery支持Js
下面为使用方法:
Usage
Add highlight
Download jquery.highlight-4.js (2 KB ) and add it to your page after jQuery. A Closure Compiler compressed version (1 KB ) is also available.
Style the highlight class
Create an entry in your style sheet for the highlight class.
. highlight { background - color : yellow }
Highlight terms
Call the highlight function with the text to highlight. To highlight all occurrances of “bla” (case insensitive) in all li elements, use the following code:
$ ( 'li' ). highlight ( 'bla' );
Remove highlighting
The highlight can be removed from any element with the removeHighlight function. In this example, all highlights under the element with the ID highlight-plugin are removed.
$ ( '#highlight-plugin' ). removeHighlight ();
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>..
蕃薯耀 2012年11月5日 15:51:06 星期一
使用jQuery实现文本高亮显示

本文介绍如何使用jQuery插件highlight-4.js实现在网页中对特定关键词进行高亮显示的功能,包括下载、使用方法、样式设置以及如何移除高亮效果。
717

被折叠的 条评论
为什么被折叠?



