Skip to content

Instantly share code, notes, and snippets.

@naoto
Forked from tomohiro/00_SPEC.mkdn
Created December 24, 2010 09:30
Show Gist options
  • Save naoto/754056 to your computer and use it in GitHub Desktop.
Save naoto/754056 to your computer and use it in GitHub Desktop.
/**
* JSON 形式のメッセージ配列を順に指定された id の要素内に表示する
*
* @param {array} messages JSON 配列
* @param {integer} interval 表示時間(ms)
* @param {string} id 要素の id
*/
module.notification = function(messages, interval, id) {
if (messages.length == 0) {
return;
}
var i = 0;
var last = message.length - 1;
var notify = function() {
$(id).html(message[i]).delay(1000).fadeIn(1500).delay(interval - 4000).fadeOut(1500);
last == i ? i = 0 : i++;
setTimeout(notify, interval);
}
notify();
};
@aajaypatell
Copy link

hello

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment