Use the mouse event to implement simple mouse effects and mouse Effects
The code is super simple, so there will be no more code here.
Copy codeThe Code is as follows:
<! Doctype html>
<Html lang = "zh-cn">
<Head>
<Meta charset = "UTF-8">
<Title> Document </title>
<Style type = "text/css">
Body, ul, li {margin: 0; padding: 0; list-style: none}
Ul li {width: 100px; height: 100px; border: 1px solid # f00; float: left; margin: 50px 10px; background-color: # ffffff ;}
Ul li. current {border: 1px solid # dfdfdf; background-color: # ff0000 ;}
</Style>
<Script type = "text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"> </script>
</Head>
<Body>
<H1> move the mouse over the following blocks <Ul>
<Li> </li>
<Li> </li>
<Li> </li>
<Li> </li>
</Ul>
</Body>
</Html>
<Script type = "text/javascript">
$ ("Ul li"). mouseover (function ()
{
$ (This). addClass ("current ");
}). Mouseout (function ()
{
$ (This). removeClass ("current ");
});
</Script>
Very simple code. I hope you can enjoy it with your reference.