Blogger Information
Blog 34
fans 0
comment 0
visits 20532
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
JQuery 常用函数与事件
小庄
Original
549 people have browsed it

JQuery 常用函数与事件


  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
  8. <title>Document</title>
  9. <style>
  10. .divShowHide{
  11. width:200px;
  12. height:200px;
  13. background:blueviolet;
  14. display:none
  15. }
  16. .divShowHideMous{
  17. width:200px;
  18. height:200px;
  19. background:rgb(68, 122, 173);
  20. display:none
  21. }
  22. </style>
  23. </head>
  24. <body>
  25. <div id="div1">
  26. <ul class="ul1">
  27. <li>点我显示div哟!
  28. <div class="divShowHide">你看见我啦! 再点,我就跑啦!!</div>
  29. </li>
  30. <li>点我显示div哟!
  31. <div class="divShowHide">你看见我啦! 再点,我就跑啦!!</div>
  32. </li>
  33. </ul>
  34. <ul class="ul2">
  35. <li>
  36. 鼠标指着我有惊喜哟!!
  37. <div class="divShowHideMous">吓死你哈哈哈哈哈哈</div>
  38. </li>
  39. </ul>
  40. </div>
  41. <script>
  42. // 1、`dom` 操作演示 2、选择器操作演示 3、鼠标事件演示
  43. $('#div1').css('color','red');//dom 操作id选择器
  44. $('.ul1').click(function(){
  45. if($('.divShowHide').css('display') == 'none'){
  46. $('.divShowHide').show();
  47. }else{
  48. $('.divShowHide').hide();
  49. }
  50. });
  51. //鼠标移入
  52. $('.ul2').mouseenter(function(){
  53. $('.divShowHideMous').show();
  54. });
  55. //鼠标移出
  56. $('.ul2').mouseout(function(){
  57. $('.divShowHideMous').hide();
  58. });
  59. // $('button').click(function(){
  60. // $('.ddd').show();
  61. // });
  62. </script>
  63. </body>
  64. </html>
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!