<div class="content">
<div style="background:url(...jpg) no-repeat #01AEF0;" class="slide-small">
<div><strong>Title</strong></div>
<div class="read_more"><a class="t_10" href="http://example.com/">Read More</a></div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
当我点击div那个有class="content"我的代码调用功能时.当我点击Read More时,会调用该函数,然后打开新页面.我不需要调用该函数,只需打开href.
$('.read_more a').click(function(e){
e.stopPropagation();
});
Run Code Online (Sandbox Code Playgroud)
events喜欢click泡到祖先元素.为了防止事件泡沫超出你的a元素...阅读:http://api.jquery.com/event.stopPropagation/
| 归档时间: |
|
| 查看次数: |
50 次 |
| 最近记录: |