💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
**hover()** hover()方法用于模拟光标悬停事件。 当鼠标移动到元素上时,会触发指定的第一个函数(mouseenter);当鼠标移出这个元素时,会触发指定的第二个函数(mouseleave)。 ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="//libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("#p1").hover(function(){ alert("你进入了 p1!"); }, function(){ alert("拜拜! 现在你离开了 p1!"); }); }); </script> </head> <body> <p id="p1">这是一个段落。</p> </body> </html> ```