2012-11-29 174 views
1

我有一個包含轉換的佈局,他們順利進入該轉換,但是一旦光標離開選定區域,就會突然返回到第一個位置。轉換,我很困惑

} 
#holder div:hover { 
    width:92px; 
    background-color:#dddddd; 
    -webkit-transition:all .4s ease-out; 
    -moz-transition:all .4s ease-out; 
    -ms-transition:all .4s ease-out; 
    -o-transition:all .4s ease-out; 
    transition:all .4s ease-out; 

這是它的編碼,任何人都可以幫助我得到它回到原來的形式順利?謝謝!

回答

2

此選擇器只在div#holder的孩子是:hover ed。

#holder div:hover { 
    background-color: #DDD; 
    -webkit-transition: all 0.4s ease-out; 
    -moz-transition: all 0.4s ease-out; 
    -ms-transition: all 0.4s ease-out; 
    -o-transition: all 0.4s ease-out; 
    transition: all 0.4s ease-out; 
    width: 92px; 
} 

這意味着您的轉換僅適用於div懸停。一旦你停止盤旋,轉換不再適用,風格將會跳回來。

爲了得到它的工作是雙向的,你需要把過渡聲明上#holder div

#holder div { 
    -webkit-transition: all 0.4s ease-out; 
    -moz-transition: all 0.4s ease-out; 
    -ms-transition: all 0.4s ease-out; 
    -o-transition: all 0.4s ease-out; 
    transition: all 0.4s ease-out; 
} 
#holder div:hover { 
    background-color: #DDD; 
    width: 92px; 
}