Skip to content

Commit 91831d3

Browse files
committed
Fixed Issues
1 parent 74a5b33 commit 91831d3

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/js/snackbar.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
width: 'auto',
3939

40-
showAction: true,
40+
showActionButton: true,
4141
actionText: 'Dismiss',
4242
actionTextColor: '#4caf50',
4343

@@ -66,9 +66,9 @@
6666
}.bind(Snackbar.current), 500);
6767
}
6868

69-
Snackbar.Snackbar = document.createElement('div');
70-
Snackbar.Snackbar.className = 'Snackbar-container ' + options.customClass;
71-
Snackbar.Snackbar.style.width = options.width;
69+
Snackbar.snackbar = document.createElement('div');
70+
Snackbar.snackbar.className = 'snackbar-container ' + options.customClass;
71+
Snackbar.snackbar.style.width = options.width;
7272
var $p = document.createElement('p');
7373
$p.style.margin = 0;
7474
$p.style.padding = 0;
@@ -77,52 +77,52 @@
7777
$p.style.fontWeight = 300;
7878
$p.style.lineHeight = '1em';
7979
$p.innerHTML = options.text;
80-
Snackbar.Snackbar.appendChild($p);
81-
Snackbar.Snackbar.style.background = options.backgroundColor;
82-
if (options.showAction) {
80+
Snackbar.snackbar.appendChild($p);
81+
Snackbar.snackbar.style.background = options.backgroundColor;
82+
if (options.showActionButton) {
8383
var actionButton = document.createElement('button');
8484
actionButton.className = 'action';
8585
actionButton.innerHTML = options.actionText;
8686
actionButton.style.color = options.actionTextColor;
8787
actionButton.addEventListener('click', function () {
88-
options.onActionClick(Snackbar.Snackbar);
88+
options.onActionClick(Snackbar.snackbar);
8989
});
90-
Snackbar.Snackbar.appendChild(actionButton);
90+
Snackbar.snackbar.appendChild(actionButton);
9191
}
9292

9393
setTimeout(function () {
9494
if (Snackbar.current === this) {
9595
Snackbar.current.style.opacity = 0;
9696
}
9797

98-
}.bind(Snackbar.Snackbar), $defaults.duration);
98+
}.bind(Snackbar.snackbar), $defaults.duration);
9999

100-
Snackbar.Snackbar.addEventListener('transitionend', function (event, elapsed) {
100+
Snackbar.snackbar.addEventListener('transitionend', function (event, elapsed) {
101101
if (event.propertyName === 'opacity' && this.style.opacity === 0) {
102102
this.parentElement.removeChild(this);
103103
if (Snackbar.current === this) {
104104
Snackbar.current = null;
105105
}
106106
}
107-
}.bind(Snackbar.Snackbar));
107+
}.bind(Snackbar.snackbar));
108108

109-
Snackbar.current = Snackbar.Snackbar;
109+
Snackbar.current = Snackbar.snackbar;
110110
document.body.style.overflow = 'hidden';
111111

112-
if (options.pos === 'top-left' || options.pos === 'top-center' || options.pos === 'top-right')
113-
Snackbar.Snackbar.style.top = '-100px';
112+
if (options.pos === 'top-left' || options.pos === 'top-center' || options.pos === 'top' || options.pos === 'top-right')
113+
Snackbar.snackbar.style.top = '-100px';
114114

115-
document.body.appendChild(Snackbar.Snackbar);
116-
var $bottom = getComputedStyle(Snackbar.Snackbar).bottom;
117-
var $top = getComputedStyle(Snackbar.Snackbar).top;
118-
Snackbar.Snackbar.style.opacity = 1;
119-
Snackbar.Snackbar.className = 'Snackbar-container ' + options.customClass + ' Snackbar-pos ' + options.pos;
115+
document.body.appendChild(Snackbar.snackbar);
116+
var $bottom = getComputedStyle(Snackbar.snackbar).bottom;
117+
var $top = getComputedStyle(Snackbar.snackbar).top;
118+
Snackbar.snackbar.style.opacity = 1;
119+
Snackbar.snackbar.className = 'snackbar-container ' + options.customClass + ' snackbar-pos ' + options.pos;
120120
if (options.pos === 'top-left' || options.pos === 'top-right')
121-
Snackbar.Snackbar.style.top = 0;
121+
Snackbar.snackbar.style.top = 0;
122122
else if (options.pos === 'top-center' || options.pos === 'top')
123-
Snackbar.Snackbar.style.top = '25px';
123+
Snackbar.snackbar.style.top = '25px';
124124
else if (options.pos === 'bottom-center' || options.pos === 'bottom')
125-
Snackbar.Snackbar.style.bottom = '-25px';
125+
Snackbar.snackbar.style.bottom = '-25px';
126126

127127
setTimeout(function () {
128128
document.body.style.overflow = 'auto';

0 commit comments

Comments
 (0)