Вопрос

I need a div to glow from a color to another and vice-versa. This is what I did using shadow animation jQuery Plugin: jsFiddle and it works well... but when I refresh the page it doesn't load and I get this error:

Maximum execution time of 30 seconds exceeded

How can I fix it?

Это было полезно?

Решение

I don't get an error, but just in case it works for you, try replacing

function(){
    shadow_normal();
}

with

function(){
    window.setTimeout(shadow_normal, 1);
}

and same with shadow_animar.

Другие советы

You don't need a plugin to do this... this snippet will toggle between red and yellow at 1/2 second flux (you can edit the colors and delay as necessary).

var toggleColor = function() {
    window.nextColor = window.nextColor == '#f00' ? '#ff0' : '#f00';
    $('#content').animate({'background-color': window.nextColor}, 500, toggleColor);
};
toggleColor();
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top