我有一个图像(#een
)可以点击。单击此图像时,它将.animate
并将缩小尺寸,并显示另一个图像(#eeneen
)(和文本)。不幸的是,#eeneen
不会到达上面的顶部(#een
的原始高度),它会粘在某处。
如何将#eeneen
提升到#een
的相同(原始)高度?没有padding
有效或其他东西..
HTML:
<div class="jumbo">
<div class="container">
<div class="col">
<div class="col-md-6 text-center">
<div class="een">
<img id="een" src="https://s3.amazonaws.com/codecademy-content/projects/broadway/design.svg" class="img-responsive center-block">
<img id="eeneen" src="http://s.petrolicious.com/2015/vintage-friday/08-aug/paris/paris-6.jpg" class="img-responsive center-block" style="display:none">
<div class="texteen" style="display:none">
<h1>Lorem ipsum.</h1>
</div>
</div>
</div>
</div>
</div>
</div>
CSS:
.jumbo {
}
.jumbo .col .een {
}
.jumbo .col .een img {
}
.jumbo .col .een #een {
height: 170px;
width: auto;
position: relative;
padding-top: 50px;
margin-top: 60px;
}
.jumbo .col .een #eeneen {
height: 200px;
width: auto;
vertical-align: middle;
}
.jumbo .col .een .texteen h1{
font-size: 14px;
}
jQuery的:
var operator = '+=';
var operator1 = '+=';
$(document).ready(function() {
$(".een").click(function() {
$("#een").animate({left:operator + '-100',
top:operator + '+100',
width:operator1 + '-85',
height:operator1 + '-85',
});
if(operator == '+='){operator = '-=';}
else{operator = '+=';}
if(operator1 == '+='){operator1 = '-=';}
else{operator1 = '+=';}
$("#eeneen").fadeToggle(300);
$(".texteen").fadeToggle(600);
});
});