jquery消息通知

所属分类:UI-工具提示

 7942  57  查看评论 (5)
分享到微信朋友圈
X
jquery消息通知 ie兼容10

更新时间:2021-12-14 23:07:33

更新说明:

1. 原来的关闭通知最终实现的是display:none 本次更新关闭通知时移除remove元素

2. 新增modal对话框支持如:遮罩,取消/确认回调,自定义按钮名称,单标题无内容,自定义标题等操作。

3. modal内置函数如下:

info, success, warning, error, question

modalInfo: function(opt) {
    opt.modal == true;
    opt.type = 'info';
    new MESSAGE(opt).render();
}, modalSuccess: function(opt) {
    opt.type = 'success';
    opt.modal = true;
    new MESSAGE(opt).render();
}, modalWarning: function(opt) {
    opt.type = 'warning';
    opt.modal = true;
    new MESSAGE(opt).render();
}, modalError: function(opt) {
    opt.type = 'error';
    opt.modal = true;
    new MESSAGE(opt).render();
}, modalQuestion: function(opt) {
    opt.type = 'question';
    opt.modal = true;
    new MESSAGE(opt).render();
},

更新时间:2021-12-13 09:23:44

largeMessage

介绍

一个方便的消息通知插件,谢谢支持

演示

094920_7f32df81_7723063.png

代码 记得引入必要文件,模块所使用图标已经内置,更多配置信息查看message.js

图标来源于fontawesome

let MESSAGE = function(opt) {
    this.title = opt.title || '提示'; //标题
    this.content = opt.content || false; //内容 如果内容为空则只显示标题
    this.position = opt.position || 'center'; //位置 目前只有居中和右
    this.closeable = opt.closeable || false; //是否显示关闭按钮
    this.type = opt.type || 'info'; //类型  success info warning error
    this.duration = opt.duration || 5; //倒计时关闭
    this.autoclose = opt.autoclose == false ? false : opt.autoclose || true; //是否自动关闭
};
<script >
    layui.config({
        base: 'module/',
        version: new Date().getTime()
    }).extend({
        message: 'message/message'
    }).use(['message'], function() {
        console.log(layui.message);
        let msg = layui.message;
        msg.success({
            content: '如果感觉体验良好请给一个免费的star可以吗',
            closeable: true,
            autoclose: false,
            title: '感谢支持'
        });
        layui.util.event('on-event', {
            cSuccess: function(othis) {
                msg.success({
                    content: '一个成功的提示不会自动关闭',
                    closeable: true,
                    autoclose: false,
                    title: '操作成功'
                });
            },
            cerror: function(othis) {
                msg.error({
                    content: '一个失败的提示不会自动关闭',
                    closeable: true,
                    autoclose: false
                });
            },
            cinfo: function(othis) {
                msg.info({
                    content: '一个提示不会自动关闭',
                    closeable: true,
                    autoclose: false
                });
            },
            cwarning: function(othis) {
                msg.warning({
                    content: '一个警告的提示不会自动关闭',
                    closeable: true,
                    autoclose: false,
                    title: '警告'
                });
            },
            rinfo: function(othis) {
                msg.info({
                    content: '一个成功的提示不会自动关闭',
                    closeable: true,
                    autoclose: false,
                    title: '右侧提示',
                    position: 'right'
                });
            },
            rsuccess: function(othis) {
                msg.success({
                    content: '一个成功的提示会自动关闭',
                    closeable: true,
                    title: '成功',
                    position: 'right'
                });
            },
            rtitle: function(othis) {
                msg.info({
                    title: '我只有标题',
                    closeable: true,
                    position: 'right',
                    autoclose: false
                });
            }
        });
    })
</script>
相关插件-工具提示

jq 提示插件

封装 jq 提示插件 Confirm ,兼容ie811chrome ff
  工具提示
 47079  407

Metro风格的jQuery个性化消息提示插件

介绍一款Metro风格的消息提示框插件,插件是基于jQuery的,不仅拥有Metro哪种简单精巧的UI风格,而且兼容性也还不错。之前分享过一些基于jQuery和CSS3的提示框插件,比如HTML5CSS3弹出提示框,感兴趣的朋友也可以前往关注。
  工具提示
 29272  343

一款腾讯UED设计的提示插件

一款腾讯UED设计的提示插件
  工具提示
 42576  435

仿win10侧边滑出提示框

一款模拟win10的消息提示框toastr
  工具提示
 28455  375

讨论这个项目(5)回答他人问题或分享插件使用方法奖励jQ币 评论用户自律公约

    0
    2022/3/5 19:15:20
    我想知道怎么才可以打开网页自动弹出而不是点击
        0
        2022/3/5 19:15:58
        我试过用jq的自动点击按钮但是不能触发,我js不太好
        1
        2022/3/30 18:16:44

        你可以直接调用弹出信息的函数呀

        layui.use(['message'], ? function() ? {
            layui.message.info({
                title: '我只有标题',
                closeable: true,
                position: 'right',
                autoclose: false
            });
        })
    回复
    spaceman 0
    2021/12/13 19:28:21
    不会自动关闭
        1
        2021/12/14 22:27:18
        自动关闭需要设置 autoclose:true
    回复
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
取消回复