The example in this article describes the method for jquery to implement the flashing caption hints for new messages. Share to everyone for your reference. Specifically as follows:
This code can be used to display the hint information flashing in the title bar.
1. jquery Plugin Style code
;(function ($) {
$.extend ({
/**
* Call method: var Timerarr = $.blinktitle.show ();
* $.blinktitle.clear (timerarr);
* * *
blinktitle: {
show:function () {//* * * * * * When new messages are blinking at title to prompt
var step=0, _title = Document.title;
var timer = setinterval (function () {
step++;
if (step==3) {step=1};
if (step==1) {document.title= ' "' +_title};
if (step==2) {document.title= ' "new Message" ' +_title};
}
; return [timer, _title];
},
/**
* @param timerarr[0], timer tag
* @param timerarr[1], initial title text content
*
/clear:function (Timerarr) {
//Remove flashing hint, restore initial title text
if (timerarr) {
clearinterval ( Timerarr[0]);
Document.title = Timerarr[1];}}
(JQuery);
2. The method of invocation is as follows:
JQuery (function ($) {
var Timerarr = $.blinktitle.show ();
settimeout (function () {//Here is automatically disappeared after a certain period of time
$.blinktitle.clear (Timerarr);
}, 10000);
If the human operation disappears, simply call it: $.blinktitle.clear (Timerarr);
};
Full instance code click here to download the site.
I hope this article will help you with your jquery programming.