Fork me on GitHub

公用提示框写法

toast: function(msg) {
var str = "<div class='toast' style='display:none'>" + msg + "</div>";
$('body').append(str);
$('.toast').stop().fadeIn(100).delay(1000).fadeOut(400); //fade out after 3 seconds
setTimeout(function() {
$('.toast').remove();
}, 1500);
}

 

.toast {
width: 200px;
height: 20px;
position: fixed;
left: 50%;
margin-left: -110px;
top: 50%;
margin-top: -10px;
background-color: #383838;
color: #F0F0F0;
padding: 5px 10px;
text-align: center;
border-radius: 2px;
-webkit-box-shadow: 0px 0px 24px -1px rgba(56, 56, 56, 1);
-moz-box-shadow: 0px 0px 24px -1px rgba(56, 56, 56, 1);
box-shadow: 0px 0px 24px -1px rgba(56, 56, 56, 1);
opacity: 0.8;
z-index: 999;
}

posted @ 2016-08-12 10:28  明天后浪  阅读(277)  评论(0编辑  收藏  举报