- BossNhà sáng lập
- Bài viết : 589
Xu : 1350
Thích : 82
[Tuts] Âm thanh thông báo như Facebook cho Toolbar
16/1/2016, 8:06 pm
Mô tả:
Khi có thông báo mới thì ngay tức khắc nó báo lên như chức năng thông báo của facebookHướng dẫn:
Bước 1:
các bạn phải bật chức năng toolbar của FM
Bước 2:
Tạo một file js mới
Title: Sound for the notifications system
Where: All pages
Code:
- Code:
var audioFile = 'http://www.freesfx.co.uk/rx2/mp3s/2/1305_1256857800.mp3';
notifChecker = setInterval('checkNotif()',500);
function checkNotif() {
if ($('.fa_notification').length > 0) {
window.clearInterval(notifChecker);
alertNotif();
}
};
dispCheck = setInterval('removeNotif()',500);
function removeNotif() {
if ($('.fa_notification').css('display') == 'none') {
$('.fa_notification').remove();
$('.audioElem').remove();
notifChecker = setInterval('checkNotif()',500);
}
};
function alertNotif() { $('body').append('<audio class="audioElem" style="display:none;" controls autoplay><source src="'+audioFile+'" type="audio/mpeg"></audio>'); };
Chú ý:
dòng 1
- Code:
var audioFile = 'http://www.freesfx.co.uk/rx2/mp3s/2/1305_1256857800.mp3';
Thay link trên bằng link âm thanh mà bạn thích.
Thông tin:
Code creator: Ange Tuteur
Code tested on: Recent browsers - All forum versions
Checked by: Niko
Nguồn: FMCODES.COM
- HandSomeVIP Member
- Bài viết : 86
Xu : 245
Thích : 41
Re: [Tuts] Âm thanh thông báo như Facebook cho Toolbar
17/1/2016, 4:02 pm
Permissions in this forum:
You cannot reply to topics in this forum