A simple Message Box UI component. Based on jQuery.
With node/npm:
npm install xsm-msgbox
Or download the source code from github: xsm-msgbox.zip
1��CMD + browserify
var XsmMsgbox = require('xsm-msgbox');
XsmMsgbox.alert('Something happened!');
2��ֱ������ .js �ļ�
<script src="path/to/xsm-msgbox.min.js" charset="UTF-8"></script>
XsmMsgbox.alert('Something happened!');
1������ .less �ļ�
ͨ�� grunt-less + less-plugin-npm-import ��ʽ��
// if you use "less-plugin-npm-import" with grunt-less:
@import "npm://xsm-msgbox"
��ʹ�ò����
@import "path/to/xsm-msgbox/index";
������� IE6��7����ʹ�ã�
@import "path/to/xsm-msgbox/ie6";
�����ֶ��� images Ŀ¼�µ�ͼƬ����������Ŀ¼����ȷ�� css �ж�ͼƬ����·�����á�
2��ֱ������ .css �ļ�
<link href="path/to/xsm-msgbox.min.css" type="text/css" rel="stylesheet">
�����Ҫ����IE6��7��
<link href="path/to/xsm-msgbox.ie6.min.css" type="text/css" rel="stylesheet">
������Ϣ���͵IJ�ͬ��ʹ����Ӧ�ķ�����alert()
, success()
, error()
��
�û��ر���Ϣ����ʱ�����Դ�������ָ���Ļص�������������ע��ص������ķ�ʽ��
// ���ú���ʱ�ṩ�ص�����
Msgbox.alert('Hi', function () {
console.log('msgbox closed');
});
// ͨ���������ض���� .done() ����ע��ص�����
Msgbox.alert('Hi').done(function () {
console.log('msgbox closed');
});
XsmMsgbox.cover()
�û��ڵ�ǰ������ʾһ�����֣���ֹ�û�������ͨ�� XsmMsgbox.close()
�ر��ڸDz㡣
- alert(message, callback)
- notice(message, callback)
- success(message, callback)
- error(message, callback)
- confirm(message, callback)
- cover(),
- close(),
- removeCover()
npm test