hover的用法及live的用法介绍(鼠标悬停效果)

 更新时间:2013年03月29日 15:32:51   作者:  
hover属性在书写css时大家都不会陌生了吧live主要用于对动态加载出来的元素绑定事件,下来将为大家详细介绍下两者的使用,感兴趣的朋友可不要错过了哈
复制代码 代码如下:

// live主要用于对动态加载出来的元素绑定事件
// 产品目录
$(".lm_div_q dd").live({
mouseenter: function() {
$(this).find("strong").addClass("tj_strong");
$(this).find("strong").next().slideDown(200); // 显示下拉框
},
mouseleave: function() {
$(this).find("strong").removeClass("tj_strong");
$(this).find("strong").next().slideUp(200); // 隐藏下拉框
}
});
// hover直接绑定事件<PRE class=javascript name="code">// 产品目录
$(".lm_div_q dd").hover(function(){
$(this).find("strong").addClass("tj_strong");
$(this).find("strong").next().stop(true,true).slideDown(200); // 显示下拉框
},function(){
$(this).find("strong").removeClass("tj_strong");
$(this).find("strong").next().stop(true,true).slideUp(200); // 隐藏下拉框
});</PRE><BR>
<BR>
<PRE></PRE>
<BR>
<BR>

相关文章

最新评论