在以下代碼(see example fiddle)中,如果鼠標懸停在綠色上,兩個紅色框的高度將會改變,但高度會向下擴展。有沒有辦法讓高度向上擴展?JavaScript:設置鼠標懸停時CSS變化的方向?
CSS:
.one{
position: absolute;
left: 110px;
top: 0px;
background: green;
}
.two {
position: absolute;
left: 70px;
top: 40px;
background: red;
height: 25px;
font-size: 25px;
}
.three {
position: absolute;
left: 200px;
top: 40px;
background: red;
height: 25px;
font-size: 25px;
}
HTML:
<div class="one">15,000,000</div>
<div class="two">700</div>
<div class="three">800</div>
的javascript:
$('.one').mouseover(function(){
$('.two, .three').css('height','50px');
}).mouseout(function(){
$('.two, .three').css('height', '25px');
});