This function let us to execute some task periodically, it takes two arguments, the function
wich will be executed and the interval in secconds between executions.
For example i will use it to display two images in a alternate manner, you could see the demo at here.
This is a simple example and we will improve it in the nexts posts.
var i = 0;
function changeImage() {
if(i%2==0){
new Effect.Fade('image1', { // the id of the element containing the image
duration: 1,
fps: 50,
afterFinish: function() { new Effect.Appear('image2', {duration: 1, fps: 50, queue:'end'})}
});
}else{
new Effect.Fade('image2', { // the id of the element containing the image duration: 1,
fps: 50,
afterFinish: function() { new Effect.Appear('image1', {duration: 1, fps: 50, queue:'end'})}
});
}
i++;
}
window.onload = new PeriodicalExecuter(changeImage, 10);
Code for Begginners
Etiquetas
- prototype (3)
- DJango (2)
- PeriodicalExecuter (1)
- Ubuntu 8.04 (1)
- git (1)
- github (1)
- models (1)
- open source tools (1)
- ubiquity (1)
Archivo del Blog
-
▼
2008
(7)
- ► 10/05 - 10/12 (1)
- ► 09/14 - 09/21 (1)
- ► 08/31 - 09/07 (1)
- ► 08/24 - 08/31 (3)
-
►
2007
(3)
- ► 12/09 - 12/16 (1)
- ► 12/02 - 12/09 (2)
