jQuery toast 淡入淡出提示
#toast{ position: fixed; top: 44%;left:50%;transform: translateX(-50%); min-width: 80px; max-width: 180px; min-height: 18px; padding: 10px; line-height: 18px; text-align: center; font-size: 16px; color: #fff; background: rgba(0, 0, 0, 0.6); border-radius: 5px; display: none; z-index: 999; } /* toast 提示 $("#toast").showMessage('网络错误,请稍后重试',1400); */ $.fn.extend({ showMessage: function( $msg, $time ){ var oDiv = document.createElement("div"); oDiv.setAttribute("id", "toast"); var oBody = document.getElementsByTagName('body')[0]; oBody.append(oDiv); $('#toast').text( $msg ); $('#toast').fadeIn(); setTimeout(function() { $('#toast').fadeOut(); }, $time); } });
相关推荐
fengyeezju 2020-06-25
安辉 2020-03-01
xilove0 2020-02-01
Roka 2019-12-14
GoAheadY 2010-08-21
sgafdsg 2011-07-19
绿豆饼 2019-11-01
我只是个程序员 2014-07-01
taiyuanwuyin 2015-03-31
未子涵 2019-09-21
FreeThinking 2019-04-16
ajaxtony 2018-12-10
tzshlyt 2019-08-20
屋顶小黑猫 2012-09-21
冰川孤辰 2019-07-01
Jemy杰 2019-07-01
mislyvinky 2019-06-29