Skip to content

Instantly share code, notes, and snippets.

@naturallucky
Last active February 22, 2018 22:27
Show Gist options
  • Save naturallucky/e7eb9702b29a35a1af3e27af1256d600 to your computer and use it in GitHub Desktop.
Save naturallucky/e7eb9702b29a35a1af3e27af1256d600 to your computer and use it in GitHub Desktop.
function blinkMessageToNotify(message){
var msg = docId("message");
var delStrLen =msg.textContent.length;
msg.textContent = msg.textContent + message;
delStrLen = msg.textContent.length - delStrLen;//be care for emoji...
setTimeout(function(){
msg.textContent = msg.textContent.substr(delStrLen);
},12600);
}
function docId(idname){
return document.getElementById(idname);
}
@naturallucky
Copy link
Author

message auto disappear after while on id="message" HTML

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