1. Disable right-click menu
Copy codeThe Code is as follows:
$ (Document). ready (function (){
$ (Document). bind ("contextmenu", function (e ){
Return false;
});
});
2. flashing the font
Copy codeThe Code is 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 ('2017, 255, 1000 );
3. Prepare a document replacement solution
Copy codeThe Code is as follows:
$ (Function (){
// Document is ready do something
});
4. Check the browser
Copy codeThe Code is 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 codeThe Code is as follows:
If ($ ("# someDiv"). length ){
// Yes it does, do something
}