当页面加载mouseover
自动生效时,我遇到此问题
以下是css
和javascript
:
$('.divTop').mouseover(function(){
$('.private').stop().animate({"top":"0px"},200);
$('.corporate').stop().animate({"bottom":"0px"},200);
});
$('.private, .corporate').mouseout(function(){
$('.private').stop().animate({top:"-50%"},200);
$('.corporate').stop().animate({bottom:"-50%"},200);
});
.private{
background-image:url('/CapitalBank/img/icon/umbrella.png');
/* border-bottom:1px solid #d2ab67; */
background-size:50px;
top:-50%;
}
.corporate{
border-top:1px solid #d2ab67;
background-image:url('/CapitalBank/img/icon/key.png');
bottom:-50%;
}
.divTop{
position:relative;
float:left;
width:500px;
height:250px;
/* outline:1px solid white; */
background-image: url('/CapitalBank/img/bg/ibank.png');
background-position:center;
background-size:100% 100%;
}
答案 0 :(得分:2)
$('.divTop').mouseenter(function(){
$('.private').stop().animate({"top":"0px"},200);
$('.corporate').stop().animate({"bottom":"0px"},200);
});
$('.private, .corporate').mouseleave(function(){
$('.private').stop().animate({top:"-50%"},200);
$('.corporate').stop().animate({bottom:"-50%"},200);
});