12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- function showTips(type,txt){
- var _html = "";
- if (type == "warn") {
- _html += '<div class="p-mytips align-center warn">';
- _html += '<span class="ic zicon-warning"></span>';
- }
- if (type == "error") {
- _html += '<div class="p-mytips align-center error">';
- _html += '<span class="ic zicon-error"></span>';
- }
- _html += '<span class="txt">'+txt+'</span>';
- _html += '</div>';
- //必须先将_html添加到body,再设置Css样式
- $("body").append(_html);
- //生成Css
- GenerateCss();
- GenerateTipsAni();
- }
- function GenerateTipsAni() {
- $(".p-mytips").removeClass("animation_slideInDown animation_slideOutUp").addClass("animation_slideInDown");
- setTimeout(()=>{
- $(".p-mytips").removeClass("animation_slideInDown").addClass("animation_slideOutUp animate__delay-1s");
- },1000)
- setTimeout(()=>{
- $(".p-mytips").remove();
- },10000)
- }
- function GenerateCss(){
- $(".p-mytips").css({
- position: 'fixed',
- top: '10vh',
- left: '50%',
- transform: 'translateX(-50%)',
- 'min-width': '380px',
- padding: '16px',
- 'z-index': '100',
- 'border-radius': '4px',
- });
- $(".p-mytips .txt").css({
- 'font-size': '14px'
- });
- $(".p-mytips .ic").css({
- 'margin-right': '10px',
- 'font-size': '16px'
- });
- $(".p-mytips.warn").css({
- 'background-color':'#fff8e6',
- 'border-color':'#fff1cc',
- 'color':'#ffba00'
- });
- $(".p-mytips.error").css({
- 'background-color':'#ffeded',
- 'border-color':'#ffdbdb',
- 'color':'#ff4949'
- });
- }
|