DooDoo
DooDoo

Reputation: 13447

jQuery animation run one time

I have a simple code like this:

<input id="Button1" type="button" value="button" />    
<table border="1" cellpadding="0" cellspacing="0" width="400px">
    <tr id="tr1">
        <td>
            1
        </td>
        <td>
            nima
        </td>
    </tr>
    <tr id="tr2">
        <td>
            2
        </td>
        <td>
            agha
        </td>
    </tr>
    <tr id="tr3">
        <td>
            3
        </td>
        <td>
            ligha
        </td>
    </tr>
</table>

and I write this code for change row one background

 $(document).ready(function () {
        $('#Button1').on('click', function () {
            $('#tr1').stop()
                     .animate({ backgroundColor: "aqua" },800)
                     .stop()
                     .animate({backgroundColor: "white"},800);
        });
    });

but it run just one time and when I click again on Button1 nothing changed. where is the problem?

(I use jQuery.Color plugin) thanks

Upvotes: 0

Views: 621

Answers (1)

Lennart
Lennart

Reputation: 1560

$(document).ready(function () {
    $('#Button1').bind('click', function () {
       $('#tr1').animate({ backgroundColor: "aqua" },800)
             .animate({backgroundColor: "white"},800);
     });
});​

This works in google chrome... try it

Upvotes: 2

Related Questions