jQuery Messenger is a powerful message plugin for developers to show up messages at front-end. It's easy to use. The main features contains:
The path is depend on the project.
<script type="text/javascript" src="../lib/jquery-1.11.1.js"></script>
<link rel="stylesheet" href="../style/jquery-messenger.css">
<script type="text/javascript" src="../jquery-messenger.js"></script>
<!-- lang file is optional, default language is English -->
<script type="text/javascript" src="../lang/zh-CN.js"></script>
Reference to demo.
Show 'info' messages with a blue box.
// Show a single string message.
Messenger.info('This is a common message alert.');
// Show a message array at one time.
Messenger.info(['Message 1st.', 'Message 2nd.', 'Message 3rd.']);
// Show jQuery object with a event button.
var btn = $('#btn').click(function(){ alert('event works.'); });
Messenger.info(btn);
// Show a message with optional parameters.
Messenger.info('Hello World!', {
target: $('#message-wrapper'),
closable: false,
messageIcon: true,
messageTime: true
});
Show 'success' messages with a green box. The usage description is the same as Messenger.info(messages, [opt]) described.
Show 'warning' messages with a yellow box. The usage description is the same as Messenger.info(messages, [opt]) described.
Show 'error' messages with a red box. The usage description is the same as Messenger.info(messages, [opt]) described.
-@returns {Messenger}
Clear all popup messages.
-@returns {Messenger}
Remove all of the cached data.
-@returns {Messenger}
Show management dialog.
-@returns {Messenger}
Close management dialog.
-@returns {Messenger}
Global plugin settings, this will override default settings.
var settings = {
/**
* true - show desktop notification.
*/
notify: true,
/**
* desktop notification message icon prefix-url.
*/
notifyIconUrl: '..',
/**
* true - show message close button.
*/
closable: true,
/**
* true - show messenger open button at the bottom of the box when message alert.
*/
handle: true,
/**
* true - each message item will append to previous one before timeout.
* false - there will be only one message item at one time.
*/
multiple: true,
/**
* Popup message max size for show up at one time, and it works if 'multiple' = true.
*/
popupSize: 5,
/**
* Messenger box layout, contains: top-left, top-center, top-right, bottom-left, bottom-center, bottom-right.
*/
layout: 'top-center',
/**
* The parent element object for messenger box.
*/
target: 'body',
/**
* The width of the messenger box. Full width is '100%'.
*/
width: 800,
/**
* The milliseconds for message closing. Default '0' timeout is calculate by text length.
*/
timeout: 0,
/**
* Maximum caching for message items.
*/
cacheSize: 1000,
/**
* Message page size in management console.
*/
pageSize: 5,
/**
* true - Upload message item automatically.
*/
autoUpload: false,
/**
* Message upload url. It works if 'autoUpload' = true.
*/
uploadUrl: 'messenger_log',
/**
* The message type that set to 'true' will be uploaded if 'autoUpload' = true.
*/
uploadType: {
info: true,
success: true,
warning: true,
error: true
},
/**
* Show message time for each item.
*/
showTime: true,
/**
* Show message icon for each item.
*/
showIcon: true,
/**
* Callback function after message created.
* @param {object} message
*/
onCreated: function (message) {
},
/**
* Callback function after message uploaded to server.
* @param {object} message
* @param {object} data json object form server side.
*/
onUploaded: function (message, data) {
},
/**
* Callback function after close a message item, from DOM or desktop notification.
* @param {object} message
* @param {object} event
*/
onClosed: function (message, event) {
}
}
-@returns {objects} settings
Get global plugin settings.
-@param {string} mid -@returns {*|{}}
Get single message by message id.
-@returns {{}}
Get all of the message cache.
-@returns {Array}
Get all of the message id cache.
-@param {boolean} enable true - Show desktop notification when current page is inactive. -@returns {Messenger}
Set desktop notification switch.
-@param {string} url -@returns {Messenger}
Set the prefix uri for desktop notification icons.
-@param {boolean} enable true - Show message closable button switch(At the top right of the message). -@returns {Messenger}
Set message closable button switch.
-@param {number} size -@returns {Messenger}
Set message cache size.
-@param {boolean} enable true - Show messages(popupSize) at one time. If the number of the message reach popupSize, the last one will be replaced by the new one. All messages will be disappeared when time out. false - Show a single message at one time. -@returns {Messenger}
Set message popup mode.
-@param {number} size -@returns {Messenger}
The maximum message number in the popup message box.
-@param {number} size -@returns {Messenger}
The maximum message number in the messenger console box.
-@param {string} layout -@returns {Messenger}
Set UI layout, top-center/top-left/top-right/bottom-center/bottom-left/bottom-right.
-@param {string|jQuery|$} target -@returns {Messenger}
Set messenger box append target.
-@returns {Messenger}
Set messenger default append target 'body'.
-@param {number|string} width Number or percentage string will be ok. -@returns {Messenger}
Set the width of the message box.
-@param {number} timeout 0 - Auto calculated by system; -@returns {Messenger}
Set message timeout. This will be override by single message definition.
-@param {boolean} enable -@returns {Messenger}
Auto upload message to server after created.
-@param {string} url -@returns {Messenger}
Messenger auto upload url.
-@param {object} typeObj {info:true, success: true, warning: true, error: true} -@returns {Messenger}
Set upload message type that need to.
-@param {boolean} enable -@returns {Messenger}
Set show/hide messenger handle bar switch when mouse hover on.
-@param {boolean} enable -@returns {Messenger}
Set show/hide message time when message created.
-@param {boolean} enable -@returns {Messenger}
Set show/hide message icon when message created. fonts
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型