我有两个div我的第一个div包含带有图像的链接,而我的第二个div带有position:absolute
我的绝对区域是不可克服的,我怎么能让它成为clikable?
我能不能点击我的位置:绝对吗?
这里你是我的代码,我正在使用bootstrap
.item img{
width:100%;
height:700px !important;
max-width:100%;
display:block;
}
.booking-form {
position: absolute;
z-index: 10;
margin-top: 45px;
right: 0;
left: 0;
}
.tab-system .tab-content{
padding:12px;
background:#FFF;
}
.carousel-control.left, .carousel-control.right {
background-image: none;
-webkit-transition: all ease-in-out 0.6s;
-moz-transition: all ease-in-out 0.6s;
transition: all ease-in-out 0.6s;
}
.carousel-control{
width: auto;
position: absolute;
bottom: auto;
top: 50%;
margin-top: -10px;
display: inline-block;
}
.carousel-control.right {
right: 10%;
}
.carousel-control.left {
left: 10%;
}
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css'>
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<div class="booking-form">
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="tab-system">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
<li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li>
<li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Messages</a></li>
<li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nam commodi accusantium, voluptas quisquam obcaecati labore odit tenetur amet ex libero iste quam, nostrum temporibus architecto mollitia ipsum dignissimos non similique.</p>
</div>
<div role="tabpanel" class="tab-pane" id="profile">...</div>
<div role="tabpanel" class="tab-pane" id="messages">...</div>
<div role="tabpanel" class="tab-pane" id="settings">...</div>
</div>
</div>
</div>
</div>
</div>
</div><!-- this is the booking form-->
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<a href="#"><img src="https://images.pexels.com/photos/40797/wild-flowers-flowers-plant-macro-40797.jpeg?w=1260&h=750&auto=compress&cs=tinysrgb"></a>
</div>
<div class="item">
<a href="#"><img src="https://images.pexels.com/photos/3247/nature-forest-industry-rails.jpg?w=1260&h=750&auto=compress&cs=tinysrgb"></a>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js'></script>
答案 0 :(得分:0)
我明白你的意思,首先你必须为你的parent元素添加pointer-events: none;
属性,你必须为你的子元素添加pointer-events: visible;
属性。
现在它在工作
.item img{
width:100%;
height:700px !important;
max-width:100%;
display:block;
}
.booking-form {
position: absolute;
z-index: 10;
margin-top: 45px;
right: 0;
left: 0;
pointer-events: none;
}
.tab-system{
pointer-events: visible;
}
.tab-system .tab-content{
padding:12px;
background:#FFF;
}
.carousel-control.left, .carousel-control.right {
background-image: none;
-webkit-transition: all ease-in-out 0.6s;
-moz-transition: all ease-in-out 0.6s;
transition: all ease-in-out 0.6s;
}
.carousel-control{
width: auto;
position: absolute;
bottom: auto;
top: 50%;
margin-top: -10px;
display: inline-block;
}
.carousel-control.right {
right: 10%;
}
.carousel-control.left {
left: 10%;
}
&#13;
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css'>
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<div class="booking-form">
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="tab-system">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
<li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li>
<li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Messages</a></li>
<li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nam commodi accusantium, voluptas quisquam obcaecati labore odit tenetur amet ex libero iste quam, nostrum temporibus architecto mollitia ipsum dignissimos non similique.</p>
</div>
<div role="tabpanel" class="tab-pane" id="profile">...</div>
<div role="tabpanel" class="tab-pane" id="messages">...</div>
<div role="tabpanel" class="tab-pane" id="settings">...</div>
</div>
</div>
</div>
</div>
</div>
</div><!-- this is the booking form-->
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<a href="#"><img src="https://images.pexels.com/photos/40797/wild-flowers-flowers-plant-macro-40797.jpeg?w=1260&h=750&auto=compress&cs=tinysrgb"></a>
</div>
<div class="item">
<a href="#"><img src="https://images.pexels.com/photos/3247/nature-forest-industry-rails.jpg?w=1260&h=750&auto=compress&cs=tinysrgb"></a>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js'></script>
&#13;