jQuery
Some text
Some other text
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>jQuery</title> <style type="text/css"> </style> <script src="jquery.js" type="text/javascript"></script> <script type="text/javascript"> $(function(){ $("div.firstBox").hover(function(){ $(this).text(" Text changed!"); }, function(){ $("div.secondBox ").append($(this)); } ) }) </script> </head> <body> <div class="firstBox">Some text</div> <div class="secondBox ">Some other text</div> </body> </html>
不运行,能猜到效果是怎样的吗.?
很有意思的是$(this)为firstBox作为整个对象直接append到secondBox后面.
本文介绍了一个使用jQuery实现的hover效果案例。当鼠标悬停在指定元素上时,该元素的文字会改变,并且此元素将被附加到另一个指定的元素之后。这种效果常用于网页互动设计中,有助于增强用户体验。
1774

被折叠的 条评论
为什么被折叠?



