$('.menu').on('click', function () {
var url = $(this).parent().find('.active').children('a').attr('data-id');
var name = $(this).parent().find('.active').children('a')[0].text;
var id = $(this).parent().find('.active').children('a')[0].hash;
if (url != null) {
top.learun.frameTab.open({ F_ModuleId: id, F_FullName: name, F_UrlAddress: url });
}
//console.log($(this).parent().find('.active').children('a')[0].hash)
})
首先获取当前页面中类是 menu 的标签,给它添加点击事件
然后再$(this)但前标签下的父节点寻找class中有active的标签find(遍历)然后选择到它的孩子节点的某个属性
本文介绍了一种使用jQuery实现的菜单点击事件处理方法,通过遍历具有特定类名的元素来改变页面中Tab的显示状态。点击事件触发后,会获取当前活动选项卡的URL、名称和ID,并调用自定义函数打开新的Tab页。
1580

被折叠的 条评论
为什么被折叠?



