Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi


I'm looping the array using each function. we are doing some animation kind of thing. we are changing the back ground color of td element in the table.we have array with td elements. if we click on any of the td elements,it loop through that array and start changing the back ground color of the each td in the array.we have 1 stop button ,(pause and start(in the same button)). when i click on stop button, it has stop entirely. when i click on pause, it has to stop then and there, if i again click on start button,it has to start from there.what logic we have written is, we are assigning 1 to Global variable variable, when we click on stop button assigning 0 to that Global variable. in the each loop, kept logic like if Global variable is

global variable is 1 run the loop else break(return false) the loop.only pause is working.

Thanks in advance, if some one helps me.






below are the code details.

C#
function GenrateDecessionLineAnimate1()
{
count=1;

   var delay = 100;
   var total=DecessionLineAnimateList1.length;

    $(DecessionLineAnimateList1).each(function () {

        var fnc = function (y) { return function () {
        if(count ==1){

        $(y).css('background-color', 'red'); $(y).focus() }
        else return false;
         }} (this)

        var fnc2 = function (y) { return function () {
        if(count ==1){
         $(y).css('background-color', '#efefef'); }
         else return false; }} (this)

        setTimeout(fnc, delay);
        setTimeout(fnc2, delay + 2000);
        delay += 2000;
           });


on the stop button click event calling the below metod.

C#
var count =1;

 function PauseAnimation()
    {
    if(count == 1)
    count=0;
    else count=1;

    }
Posted
Updated 7-Mar-13 2:55am
v2
Comments
criselda 9-Mar-13 0:21am    
I don't think it's possible,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900