Because before finding an open source is very easy to use, can be fixed in the bottom right corner of the browser, compatibility is also good, and then affect the application of a small function point, decided to rewrite one; this can only be fixed on the current page of the lower right add, the system is up and down structure to meet the demand, not continue to expand;
Two functions:
1.lay--Set Cue box width (optional)
2.show--Set title, content, and stay time
Notice.js
var time;
var delaytime; $ (function () {///increase floating div $ (' body '). Append ("<div id= ' notice ' onselectstart= ' return false ' ><span class= ' notice _title ' > </span><span class= ' cbtn ' >[closed]</span><div class= ' notice_content ' ></
Div></div> "); Change Style $ (' #notice '). CSS ({right: "0", Bottom: "0", cursor: "Default", Position: "Fixed", "Background-color": "#CFDEF4", Color: "#1F336B", "Z-index": "999", Border: "1px #1F336B solid", margin: "2px", padding: "10px", "font-weight": "Bold", "
Line-height ": 25px", display: "None"}); $ (' #notice. cbtn '). CSS ({color: "#FF0000", cursor: "Pointer", "Padding-right": "5px", float: "Right", Position: "Relative
"}); $ (' #notice. notice_content '). CSS ({margin: "3px", "font-weight": "Normal", border: "1px #B9C9EF solid", "line-height": "
20px "," Margin-bottom ":" 10px ", padding:" 10px "});
/* Bind Event/* (' #notice '). Hover (function () {$ (this). Stop (True,true) Slidedown ();
Cleartimeout (time); The function () {time = settimeout (' _notIce () ', delaytime);
}
);
Bind Shutdown Event $ ('. Cbtn '). Bind (' click ', Function () {$ (' #notice '). Slideup (' fast ');
Cleartimeout (time);
});
});
$.extend ({lay:function (_width,_height) {$ (' #notice '). css ({width:_width,height:_height});
}, Show:function (_title,_msg,_time) {delaytime = _time;
$ ('. Notice_title '). HTML (_title);
$ ('. Notice_content '). HTML (_MSG);
$ (' #notice '). Slidedown (2000);
Time = settimeout (' _notice () ', delaytime);
},
});
function _notice () {$ (' #notice '). Slideup (2000);}
Index.html
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
The above is the entire contents of this article, I hope you can enjoy.