notice opacity

This commit is contained in:
DIYgod 2017-08-19 16:47:16 +08:00
parent 644e4734d5
commit 6bf1975bf2
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
3 changed files with 5 additions and 8 deletions

2
dist/DPlayer.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1112,19 +1112,16 @@ class DPlayer {
};
}
notice (text, time) {
notice (text, time = 2000, opacity = 0.8) {
const noticeEle = this.element.getElementsByClassName('dplayer-notice')[0];
noticeEle.innerHTML = text;
noticeEle.style.opacity = 1;
noticeEle.style.opacity = opacity;
if (this.noticeTime) {
clearTimeout(this.noticeTime);
}
if (time && time < 0) {
return;
}
this.noticeTime = setTimeout(() => {
noticeEle.style.opacity = 0;
}, time || 2000);
}, time);
}
destroy () {