jQuery 抄袭笔记(11) : Hover()
13 Oct 2011</embed>
hover(over,out)一个模仿悬停事件(鼠标移动到一个对象上面及移出这个对象)的方法。
当鼠标移动到一个匹配的元素上面时,会触发指定的第一个函数。当鼠标移出这个元素时,会触发指定的第二个函数。
over (Function) : 鼠标移到元素上要触发的函数
out (Function) : 鼠标移出元素要触发的函数
01 <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
02 <html xmlns=“http://www.w3.org/1999/xhtml”>
03 </span>
04 <meta http-equiv=“Content-Type” content=“text/html; charset=gb2312″ />
05</span>Hello Lazynight!</title>
06 <script src=“jquery-1.1.3.pack.js” type=“text/javascript”></script>
07 <script type=“text/javascript”>
08 $(document).ready(function(){
09 $(“#Lazy_list li”).hover(function(){
10 $(this).addClass(“black”);},
11 function(){
12 $(this).removeClass(“black”);
13
14 });
15 });
16 </script>
17
18 .black{background:#000; }
19
20 </head>
21 </span>
22 <ul id=“Lazy_list”>
23</span>Lazynight | 夜阑</li>
24</span>Lazynight | 夜阑</li>
25</span>Lazynight | 夜阑</li>
26</span>Lazynight | 夜阑</li>
27</span>Lazynight | 夜阑</li>
28</span>Lazynight | 夜阑</li>
29</span>Lazynight | 夜阑</li>
30 </ul>
31 <ul id=“Lazy_list2″>
32</span>Lazynight | 夜阑</li>
33</span>Lazynight | 夜阑</li>
34</span>Lazynight | 夜阑</li>
35</span>Lazynight | 夜阑</li>
36</span>Lazynight | 夜阑</li>
37</span>Lazynight | 夜阑</li>
38</span>Lazynight | 夜阑</li>
39 </ul>
40
41 </body>
42 </html> </div> 下载源码 转载请注明:[于哲的博客][1] » [jQuery 抄袭笔记(11) : Hover()][2] [1]: http://lazynight.me [2]: http://lazynight.me/489.html
02 <html xmlns=“http://www.w3.org/1999/xhtml”>
03 </span>
04 <meta http-equiv=“Content-Type” content=“text/html; charset=gb2312″ />
05
06 <script src=“jquery-1.1.3.pack.js” type=“text/javascript”></script>
07 <script type=“text/javascript”>
08 $(document).ready(function(){
09 $(“#Lazy_list li”).hover(function(){
10 $(this).addClass(“black”);},
11 function(){
12 $(this).removeClass(“black”);
13
14 });
15 });
16 </script>
17
18 .black{background:#000; }
19
20 </head>
21 </span>
22 <ul id=“Lazy_list”>
23
24
25
26
27
28
29
30 </ul>
31 <ul id=“Lazy_list2″>
32
33
34
35
36
37
38
39 </ul>
40
41 </body>
42 </html> </div> 下载源码 转载请注明:[于哲的博客][1] » [jQuery 抄袭笔记(11) : Hover()][2] [1]: http://lazynight.me [2]: http://lazynight.me/489.html