a b
ie11、firefox、chrome等现代浏览器
只需要将上层元素添加css样式
pointer-events: none;
兼容ie老版本的方法:
if(navigator.appName == "Microsoft Internet Explorer"&&parseInt(navigator.appVersion.split(";")[1].replace(/[ ]/g, "").replace("MSIE",""))<=9){ $('#canvas').on('click', function (event) { var x = event.clientX; var y = event.clientY; var e = jQuery.Event(event.type, { pageX: x, pageY:y }); $("table td").each(function(){ var tx = $(this).offset().left; var ty = $(this).offset().top; var tx1 = tx + $(this).width(); var ty1 = ty + $(this).height(); if(x>=tx && x<= tx1 && y>=ty && y<=ty1){ $(this).trigger(e); return false; } }); });}$('table').on('click', 'td', function () { alert("底层元素点击事件被触发了")});