I can't put it to work without the setTimeOut(). The solution I have
found was to use setTimeOut without the time part. It works fine
now... Look what I've done:


$("#admperm").show();

setTimeout( function() {
    $('#admperm').css({backgroundColor: '#ff0'});
    $('#admperm').animate({backgroundColor: '#fff'}, 1000);
});


This work. But I was trying to do something like this before:


$("#admperm").show();
$('#admperm').css({backgroundColor: '#ff0'});
$('#admperm').animate({backgroundColor: '#fff'}, 1000);


This did'nt work. Don't know why... The code only works inside
setTimeOut() function.

I will read your article. I'm loving learning JQuery. It's simply
SUPER FUN to develop with it. =)

Thanks,
rics




On Dec 26, 1:54 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote:
> Hi Rics,
>
> Glad it works for you. I used setTimeout() in the code that I sent to
> you, so I'm not sure why you're mentioning that you must use it. Are
> you using it somewhere other than the place where I'm using it? I put
> it in the callback of the fadeIn() method so that the element would
> stay yellow for 3 seconds before it starts fading out.
>
> setTimeout() is a method of the window object, and it's native
> JavaScript. It is not exclusive to jQuery at all. That's probably why
> you couldn't find anything in the jQuery docs. Actually, I wrote about
> a little gimmick that you could use instead of setTimeout() if you
> just want to chain some jQuery methods together:
>
> http://www.learningjquery.com/2007/01/effect-delay-trick
>
> Your English is fine. :-)
>
> --Karl
> _________________
> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> On Dec 26, 2007, at 7:07 AM, rics wrote:
>
>
>
> > Yessssssssss!!!! :))))))))
>
> > Now it works. But I must use setTimeOut(). Without it the effect
> > didn't work. You know why? I couldn't find anything in JQuery docs
> > about it and the plugin even have any docs.
>
> > Oh, and by the way, my english is "understandable"? I'm brazilian and
> > not very good with the english language! :D
>
> > Merry Christmas,
> > rics
>
> > On Dec 25, 1:31 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote:
> >> On Dec 24, 2007, at 11:35 AM, rics wrote:
>
> >>> Hello,
>
> >>> I'm a PHP developer, but all this javascript thing is new to me.
> >>> It's
> >>> the first time I try to do something with javascript and I'm using
> >>> JQuery to help me do things fast (and best).
>
> >>> I wish to make some highlight effect, but can't figure it out by
> >>> myself. Can you help me?
>
> >>> I wish to click a checkbox and then "flash" a div using yellow
> >>> background. I think I have to paint the div background with yellow
> >>> and
> >>> then fade to transparent again. Am I thinking correct? How can I do
> >>> that?
>
> >>> Thanks,
> >>> rics, from Brazil.
>
> >> Hi Rics,
>
> >> You can use the color plugin to animate a color from yellow to white
> >> (or to some other color, but not to transparent).
>
> >>http://plugins.jquery.com/project/color
>
> >> Then you could write a script like this (you'll need to change the
> >> selectors "someCheckBox" and "#flash" to suit your situation):
>
> >>     $(document).ready(function() {
> >>       $('someCheckBox').click(function() { // on clicking some
> >> checkbox ...
> >>         $('#flash').css({backgroundColor: '#ff0'}); // ... set
> >> background color to yellow.
> >>         setTimeout(function() {
> >>           $('#flash').animate({backgroundColor: '#fff'}, 1000); //
> >> Then, animate bg color to white, but first ...
> >>         },
> >>         3000); // ... wait 3 seconds
> >>       });
> >>     });
>
> >> Hope that helps.
>
> >> --Karl
> >> _________________
> >> Karl Swedbergwww.englishrules.comwww.learningjquery.com

Reply via email to