0
首先,例如JS代碼:stopPropagation困境?
$(function(){
$('body').click(function(){alert('body clicked');});
$('body').on('click','.post-header',function(e){
e.stopPropagation();
$(this).next('.post-content').slideToggle();
})
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<body>
<div class="post-wrapper">
<h2 class="post-header">Lorem Ipsum</h2>
<div class="post-content">
<p>Lorem Ipsum is simply dummy text of....</p>
</div>
</div>
</body>
我的問題是,如果e.stopPropogation()殺死對身體冒泡,怎麼來的單擊事件擊中身體,並觸發處理程序運行幻燈片代碼?