欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-08-10 21:19:57
代码如下: // live主要用于对动态加载出来的元素绑定事件 // 产品目录 $(".lm_p_q dd").live({ mouseenter: function() { $...

代码如下:

// live主要用于对动态加载出来的元素绑定事件
// 产品目录
$(".lm_p_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_p_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>