top

Posts tagged with search

Search-hilite also

眼馋firefox的页面搜索有高亮的效果,很想在blog上也搞一个这样的效果,如果你也眼馋的话,来试一试吧.

其实每什么难的,加一个插件不就好了,so more for wordpress.我用了一个名为google highlight的插件(默认不支持中文),虽然名字里只有google,但是它还支持了lycos,yahoo和wordpress的站内搜索,(本站启用了livesearch,说不定过几天后也支持了 :))

使用方法很简单,放到plugins目录,然后后台激活.over

接着你就可以尝试一些花哨的想法,比如高亮闪烁(一点也不花哨...) ,还可以修改,让它支持中文字符(修改成中文支持以后,判断高亮变得不太准确了...)

试一下效果,点击 mootools+lightbox

如果你觉得还可以的话,继续看下面的代码(基于mootools)

var searchHilite = new Class({
initialize: function()
{
this.hlclass = "hilite";
this.items = $A(document.getElementsByClassName(this.hlclass));
if (this.items.length == 0) return false;
this.hilite();
},
hilite: function()
{
this.items.each(function(item)
{
new Fx.Color(item,'background-color',{duration: 2000}).custom('#ffffff','#D81317');
new Fx.Color(item,'color',{duration: 2000}).custom('#999999','#ffffff');
});
}
});
window.onload = function () { new searchHilite(); }

ok,love your owner highlight

 1