您的位置:首页 > Web前端 > JQuery

锋利的jQuery(知识杂货铺)

2017-02-28 21:54 281 查看
jQuery有两个合成事件:
hover()
方法、
toggle()
方法。

hover(enter,leave);


$(function () {
$('#panel h5.head').hover(function () {
$(this).next('div.content').show();
},function () {
$(this).next('div.content').hide();
})
})


hover()方法用于模拟光标悬停事件。

toggle(fn1,fn2,fn3,...,fnN)


$(function () {
$('#panel h5.head').toggle(function () {
$(this).next('div.content').show();
},function () {
$(this).next('div.content').hide();
})
})


toggle()方法用于模拟鼠标连续单击事件。

事件冒泡问题:事件会按照DOM的层次结构像水泡一样发生连锁反应。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: