-
-
Save naoto/754056 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello