A jQuery message notify plugin 基于jQuery的一个消息通知显示插件
1.设置容器元素,引入js, css
1 2 3 | <script src="js/jquery-3.3.1.min.js"></script><script src="js/message.js"></script><link rel="stylesheet" href="css/message.css"> |
1 2 3 | <body> <div id="message"></div></body> |
2.初始化
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | MessagePlugin.init({ elem: "#message", msgData: [{ text: "message1", id: 1, readStatus: 1 }, { text: "message2", id: 2, readStatus: 0 }, { text: "message3", id: 3, readStatus: 0 }, { text: "message4", id: 4, readStatus: 0 }, { text: "message5", id: 5, readStatus: 0 }, { text: "message6", id: 6, readStatus: 0 } ], msgUnReadData: 99, noticeUnReadData: 99, msgClick: function(obj) { alert("消息点击事件"); }, noticeClick: function(obj) { alert("提醒点击事件"); }, allRead: function(obj) { alert("全部已读"); }, getNodeHtml: function(obj, node) { if (obj.readStatus == 1) { node.isRead = true; } else { node.isRead = false; } var html = "<p>" + obj.text + "</p>"; node.html = html; return node; }}); |
特别申明:
本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com