mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-29 22:45:14 -04:00
Refactor notifications.
This commit is contained in:
parent
73496c6b7c
commit
2365c23af7
2 changed files with 26 additions and 10 deletions
|
@ -1,19 +1,21 @@
|
|||
modulejs.define('view/notification', ['$'], function ($) {
|
||||
modulejs.define('view/notification', ['$', 'view/root'], function ($, root) {
|
||||
|
||||
var template = '<div id="notification"/>';
|
||||
var $el = $(template);
|
||||
|
||||
function set(content) {
|
||||
|
||||
if (content) {
|
||||
$('#notification').stop(true, true).html(content).fadeIn(400);
|
||||
$el.stop(true, true).html(content).fadeIn(400);
|
||||
} else {
|
||||
$('#notification').stop(true, true).fadeOut(400);
|
||||
$el.stop(true, true).fadeOut(400);
|
||||
}
|
||||
}
|
||||
|
||||
$(template).hide().appendTo('body');
|
||||
$el.hide().appendTo(root.$el);
|
||||
|
||||
return {
|
||||
$el: $el,
|
||||
set: set
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue