//浮动提示框 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);},
时间: 2024-11-08 09:44:09