按特定时间突出显示跨度(使用Jquery): [英] highlight a span by specific time(with Jquery):

查看:63
本文介绍了按特定时间突出显示跨度(使用Jquery):的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用jQuery按特定时间突出显示跨度.
例如:(在20秒内突出显示此行)

I want to highlight a span by specific time with jquery.
for example:(highlight this line in 20 sec)

<span> highlight me slowly by specific time</span>
window.setTimeout(function() {
    // what do i must write here?
}, 20*1000);



我想要这个结果:
http://8pic.ir/images/sk9q76r96e3dc1rq4zo.swf



I want this Result:
http://8pic.ir/images/sk9q76r96e3dc1rq4zo.swf

推荐答案

以下是我在网上找到的一些代码.它使用jQuery UI.

Here is some code I found on the web. It uses jQuery UI.

function changeColor(element, curNumber){
    curNumber++;

    if(curNumber > 4){
        curNumber = 1;
    }

    element.addClass('color' + curNumber, 1000);

    // So previous classes get removed.
    element.attr('class', 'color' + curNumber);

    setTimeout(function(){changeColor(element, curNumber)}, 2000);
}

changeColor(


(' #testElement'), 0 );


我在这里得到了答案:
http://stackoverflow.com/questions/12122467/highlight-a-span-按特定时间withjquery
i got my answer here:
http://stackoverflow.com/questions/12122467/highlight-a-span-by-specific-timewith-jquery


这篇关于按特定时间突出显示跨度(使用Jquery):的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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