为何Android Toast提示如此简洁,能否拓展为长尾词?
- 内容介绍
- 文章标签
- 相关推荐
本文共计160个文字,预计阅读时间需要1分钟。
javascript// 自定义弹框功能function Toast(msg, duration) { duration=isNaN(duration) ? 1500 : duration; var m=document.createElement('div'); m.innerHTML=msg; m.style.cssText=width: 10%; min-width: 150px; opacity: 0.7; height: 30px; color: #fff; document.body.appendChild(m); setTimeout(function () { document.body.removeChild(m); }, duration);}
//自定义弹框 function Toast(msg, duration) { duration = isNaN(duration) ? 1500 : duration; var m = document.createElement('div'); m.innerHTML = msg; m.style.cssText = "width: 10%;min-width: 150px;opacity: 0.7;height: 30px;color: rgb(255, 255, 255);line-height: 30px;text-align: center;border-radius: 5px;position: fixed;top: 40%;left: 20%;z-index: 999999;background: rgb(0, 0, 0);font-size: 12px;"; document.body.appendChild(m); setTimeout(function () { var d = 0.5; m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in'; m.style.opacity = '0'; setTimeout(function () { document.body.removeChild(m) }, d * 1000); }, duration); }
本文共计160个文字,预计阅读时间需要1分钟。
javascript// 自定义弹框功能function Toast(msg, duration) { duration=isNaN(duration) ? 1500 : duration; var m=document.createElement('div'); m.innerHTML=msg; m.style.cssText=width: 10%; min-width: 150px; opacity: 0.7; height: 30px; color: #fff; document.body.appendChild(m); setTimeout(function () { document.body.removeChild(m); }, duration);}
//自定义弹框 function Toast(msg, duration) { duration = isNaN(duration) ? 1500 : duration; var m = document.createElement('div'); m.innerHTML = msg; m.style.cssText = "width: 10%;min-width: 150px;opacity: 0.7;height: 30px;color: rgb(255, 255, 255);line-height: 30px;text-align: center;border-radius: 5px;position: fixed;top: 40%;left: 20%;z-index: 999999;background: rgb(0, 0, 0);font-size: 12px;"; document.body.appendChild(m); setTimeout(function () { var d = 0.5; m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in'; m.style.opacity = '0'; setTimeout(function () { document.body.removeChild(m) }, d * 1000); }, duration); }

