/
modal.js
47 lines (41 loc) · 895 Bytes
/
modal.js
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
/**
* @module modal
*/
modules.define(
'modal',
['i-bem__dom', 'popup'],
function(provide, BEMDOM) {
/**
* @exports
* @class modal
* @bem
*
* @bemmod visible Represents visible state
*/
provide(BEMDOM.decl(this.name, /** @lends modal.prototype */{
onSetMod : {
'js' : {
'inited' : function() {
this._popup = this.findBlockOn('popup');
},
'' : function() {
this.delMod('visible');
}
},
'visible' : function(modName, modVal) {
this._popup.setMod(modName, modVal);
}
},
/**
* Sets content
* @param {String|jQuery} content
* @returns {modal} this
*/
setContent : function(content) {
BEMDOM.update(this.elem('content'), content);
return this;
}
}, /** @lends modal */{
live : true
}));
});