zl程序教程

您现在的位置是:首页 >  其它

当前栏目

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

介绍 用法 效果 Live Hover 鼠标悬停
2023-06-13 09:14:48 时间
复制代码代码如下:

//live主要用于对动态加载出来的元素绑定事件
//产品目录
$(".lm_div_qdd").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直接绑定事件<PREclass=javascriptname="code">//产品目录
$(".lm_div_qdd").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>