【发布时间】:2016-09-06 16:17:13
【问题描述】:
最初图像仅可见,按钮隐藏在图像后面。在图像鼠标悬停在图像顶部小,按钮将出现在图像底部。 但是如何将按钮隐藏在图像中?
在鼠标悬停之前,图像仅在鼠标悬停在图像混乱和可见按钮后可见。我试过这样但没有得到,这里 sn-p 供参考(http://www.olleep.com/)我正在尝试做同样的事情
$(document).ready(function() {
$('#textbox').mouseenter(function() {
$('#textbox').animate({
'marginTop' : "-=30px" //moves up
});
});
$('#textbox').mouseleave(function() {
$('#textbox').animate({
'marginTop' : "+=30px" //moves up
});
});
});
.container{
margin:50px;
}
#textbox{
position:relative;
width:300px;
}
#text{
position:relative;
overflow:hidden;
z-index:1;
background-color:#282727;
text-align:center;
padding:10px 10px 10px 10px;
}
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div id="textbox">
<img src="http://i.imgur.com/9hr2mlL.png" width="300px">
<div id="text">
<button class="btn btn-danger btn-md">MORE INFO</button>
<button class="btn btn-danger btn-md">BOOK NOW</button></div>
</div>
</div>
【问题讨论】:
标签: jquery html css twitter-bootstrap