Im not sure if i understood what you want, but try this:

function glow(){
if($('#front').data('state')==true)return false;
       var myCols = [{param:'background-color', fromColor: '#222',
toColor: 'random', random: true}]
       $('#front').colorBlend(myCols).data('state',true);
}

function stopGlow(){
if($('#front').data('state')!=true)return false;
       var myCols = [{action: 'stop'}]
       var myCols2 = [{param: 'background-color', toColor: '#222',
isFade: false, cycles: 1}]
       $("#front").colorBlend(myCols).colorBlend(myCols2);
  $('#front').colorBlend(myCols).data('state',false);
}


2009/6/1 w.m...@hotmail.co.uk <w.m...@hotmail.co.uk>

>
> Hi everyone,
>
> I'll post the code first and then ask my question...
>
> $('input, select, textarea').change().focus(function(){glow
> (self)}).blur(function(){stopGlow()})
>
> function glow(){
>        var myCols = [{param:'background-color', fromColor: '#222',
> toColor: 'random', random: true}]
>        $('#front').colorBlend(myCols);
> }
>
> function stopGlow(){
>        var myCols = [{action: 'stop'}]
>        var myCols2 = [{param: 'background-color', toColor: '#222',
> isFade: false, cycles: 1}]
>        $("#front").colorBlend(myCols).colorBlend(myCols2);
>
> }
>
> so...i have my form, and i want the function glow() to happen when an
> input is focused. Then when it unfocuses stopGlow() should happen.
> This all works perfectly, but, when you tab from input 1 to input to
> stopGlow() occurs then glow() occurs.
>
> The problem with this is that i want glow() to just carry on when any
> input is focused. Using something like:
>
> if($("input").is(":focus")){return false;} doesn't work, so i'm not
> sure what to do.
>
> I hope you understand my question and can help!
>
> Wmonk
>



-- 
Gustavo Salome Silva

Reply via email to