jquery有两个合成事件--hover()方法和toggle()方法
1.hover(enter,leave)
hover方法用于模拟光标悬停事件.当光标移动到元素上时,会触发第一个函数,移出这个元素时,会触发第二个函数.
$(function(){
$("#panel h5.head").hover(function(){
$(this).next().show();
},function(){
$(this).next().hide();
})
})
2.toggle(fn1,fn2,...fnN)
(1):模拟鼠标连续点击事件,第一个点击触发fn1,第二次触发fn2.......,随后轮番进行调用;
$(function(){
$("#panel h5.head").toggle(function(){
$(this).next().show();
},function(){
$(this).next().hide();
})
})
(2):toggle()切换元素的可见状态
$("#panel h5.head").toggle(function(){
$(this).next().toggle();
},function(){
$(this).next().toggle();
})