我有個面板div
裏面那個div
我有小round div
。 當點擊panel div
它重定向到另一頁。CSS3:點擊面板上的圓形格
雖然點擊小round div
我得到另一個div
下面。但是當我點擊小round div
然後它也重定向到另一個頁面。我怎樣才能防止這一點?
$(document).ready(function() {
$('.small_round_inner_div').click (function(){
$('.common_cateogory_status_edit_div').slideToggle('slow');
});
});
.panel_div{
width:300px;
height:300px;
background:#dee5e7;
position:relative;
cursor:pointer;
}
.small_round_main_div{
position:absolute;
right:15px;
top:15px;
}
.small_round_main_div .small_round_inner_div{
width:30px;
height:30px;
background:purple;
border-radius:50%;
}
.common_cateogory_status_edit_div {
background: #fff;
position: absolute;
right: 0px;
top: 35px;
border: thin #ced0d1 solid;
z-index: 1001;
width: 130px;
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.05);
display:none;
}
.common_cateogory_status_edit_div ul {
padding: 0;
margin: 0;
}
.common_cateogory_status_edit_div ul li {
padding: 5px 15px;
list-style-type: none;
color: #838383;
}
.common_cateogory_status_edit_div ul li:hover {
background: #edf1f2;
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a href="https://www.google.com/">
<div class="panel_div">
Some Text
<div class="small_round_main_div">
<div class="small_round_inner_div"></div>
<div class="common_cateogory_status_edit_div fadeIn animated" >
<ul>
<li><span>Option 1</span></li>
</ul>
</div>
</div>
</div>
</a>
任何幫助將是巨大的。
我使用角度2。 – Rishi
@Rishi你是什麼意思。我的答案不能做你想要的嗎? –
實際情況是我正在角2中開發它。所以'event.stropPropagation()'可能會起作用嗎? – Rishi