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 Swedberg
www.englishrules.com
www.learningjquery.com

Reply via email to