non blocking UI repeating a function

non blocking UI repeating a function

Hi,
i have this liltte function :
function Button3_onclick() 
 if (j > 5)  { 
 changebackground();   j = 1; 
 } 
 else {
 j += 1;  movebackgAround();
 }  
}

movebackground affect the background-position property and changebackground do other animations stuff .

now how to execute this code forever but without blocking the browser, i have tried with a callback but it block and freeze

thanks and good day .