1. Disable the right button menu
Copy Code code as follows:
$ (document). Ready (function () {
$ (document). Bind ("ContextMenu", function (e) {
return false;
});
});
2. Let the font blink
Copy Code code as follows:
JQuery.fn.flash = function (color, duration)
{
var current = this.css (' color ');
This.animate ({color: ' rgb (' + color + ') '}, DURATION/2);
This.animate ({color:current}, DURATION/2);
}
$ (' #someid '). Flash (' 255,0,0 ', 1000);
3. Prepare document Replacement Scheme
Copy Code code as follows:
$ (function () {
Document is ready do something
});
4. Detect Browser
Copy Code code as follows:
Safari
if ($.browser.safari)
{
Do something
}
Above IE6
if ($.browser.msie && $.browser.version > 6)
{
Do something
}
IE6 and below
if ($.browser.msie && $.browser.version <= 6) {//do something}//Firefox 2 and above if ($.browser.mozilla && $.browser.version >= "1.8")
{
Do something
}
5. Check for existing elements
Copy Code code as follows:
if ($ ("#someDiv"). Length) {
//yes it does, do something
}
/div>