orbit-basic/public/desktop_widgets/school_events/school_events.js

21 lines
540 B
JavaScript
Raw Normal View History

var eventsjson = new Array;
var loadEvents = function(){
$.getJSON(o.widgetfolder+"/school_events/events.json",function(events){
$.each(events,function(i,event){
eventsjson.push(event);
})
displayevents();
})
}
var i = 0;
var displayevents = function(){
$("#school_events").fadeOut(500);
$("span#date").text(eventsjson[i].date);
$("span#event").text(eventsjson[i].event);
$("span#timings").text(eventsjson[i].timing);
$("#school_events").fadeIn(500);
i++;
if(i==eventsjson.length)i=0;
setTimeout(displayevents,5000);
}