1
因此,与不同的Z-指标元素,继承人一些代码:如何使用同时鼠标按下事件上使用jquery
<!DOCTYPE html>
<html>
<head><title></title>
<script language = 'Javascript' type = 'text/javascript' src = 'jquery-1.10.2.js'></script> // jquery link there
<script language = 'Javascript' type = 'text/javascript'>
$(function() {
$('#div1').mousedown(function(event) { $(this).css(bla).css(bla) });
$('#div2').mousedown(function(event) { $(this).css(blah).css(blah) });
}); // end document.ready
</script></head>
<body>
<div id = 'div1' style = 'position: absolute; left: 50px;
top: 50px; z-index: 2; width: 50px; height: 50px; margin: 0px; padding: 0px;
border: 1px blue solid;'>Here</div>
<div id = 'div2' style = 'position: absolute; left:30px;
top: 50px; z-index: 1; width: 200px; height: 200px; margin: 0px; padding: 0px;
border: 1px blue solid; background-color: blue;'></div>
</body>
</html>
这一点很重要的div相对于身体定位,所以我不包住一个在另一个之内。不过,我会同时点击两个div。如何让mousedown事件先在#div1上触发,然后在#div2上触发,而不将第二个div放在第一个div里面? (或相反亦然)。我感觉这很简单,所以原谅我的愚蠢。如果以某种方式做到这一点是不可能的,有没有办法用jquery综合#div2事件?谢谢。