标签:height dcl move htm ror else 浮动 rem error
//浮动提示框 1秒后消失
toast(msg, isError, sec) {
var div = $(‘#toast‘);
div.html(msg);
div.css({visibility: ‘hidden‘});
if (isError) {
div.addClass("error");
} else {
div.removeClass("error");
}
var top = ($(window).height() - div.height()) / 2;
var left = ($(window).width() - (div.width() || 80)) / 2;
var scrollTop = $(document).scrollTop();
var scrollLeft = $(document).scrollLeft();
div.css({position: ‘absolute‘, ‘top‘: top + scrollTop, left: left + scrollLeft, visibility: ‘‘}).show();
//1秒后隐藏
var sec = sec || 3000;
div.delay(sec).hide(0);
},
标签:height dcl move htm ror else 浮动 rem error
原文地址:http://www.cnblogs.com/hqb-blog/p/6928875.html