-
-11 11
-
jquery的hover属性具体我还没有用过,但是看了文档,感觉应该是个非常不错的效果!给php爱好者们介绍介绍!
以下类容摘自jqery文档:
hover(over,out)
一个模仿悬停事件(鼠标移动到一个对象上面及移出这个对象)的方法。这是一个自定义的方法,它为频繁使用的任务提供了一种“保持在其中”的状态。当鼠标移动到一个匹配的元素上面时,会触发指定的第一个函数。当鼠标移出这个元素时,会触发指定的第二个函数。而且,会伴随着对鼠标是否仍然处在特定元素中的检测(例如,处在div中的图像),如果是,则会继续保持“悬停”状态,而不触发移出事件(修正了使用mouseout事件的一个常见错误)。Simulates hovering (moving the mouse on, and off, an object). This is a custom method which provides an 'in' to a frequent task.Whenever the mouse cursor is moved over a matched element, the first specified function is fired. Whenever the mouse moves off of the element, the second specified function fires. Additionally, checks are in place to see if the mouse is still within the specified element itself (for example, an image inside of a div), and if it is, it will continue to 'hover', and not move out (a common error in using a mouseout event handler).返回值
jQuery
参数
over (Function) : 鼠标移到元素上要触发的函数
out (Function) : 鼠标移出元素要触发的函数
示例
鼠标悬停的表格加上特定的类
jQuery 代码:
$("td").hover(
function () {
$(this).addClass("hover");
},
function () {
$(this).removeClass("hover");
}
);大家可以试着写写!看看具体的效果,应该非常不错的!
本文来源于php爱好者:php教程 —http://www.phplover.cn/
原文地址:http://www.phplover.cn/post/jquery-hover-over-out.html
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
2楼 淘宝网
Post:2010-5-14 20:26:19
1楼 ZNZBLOG
Post:2009-11-11 16:28:54