0
有什麼方法可以在CSS中獲取目標對象的當前寬度嗎?CSS - currentwidth + px
我正在搞動畫,它會真的有用這樣的功能。
例子:
/*What has to be done atm*/
@keyframes identifier {
0%{width: 50px}
25%{width: 100px}
50%{width: 150px}
75%{width: 200px}
100%{width: 250px}
}
/*What I would like*/
@keyframes identifier {
0%{width: currentwidth +50px}
25%{width: currentwidth +50px}
50%{width: currentwidth +50px}
75%{width: currentwidth +50px}
100%{width: currentwidth +50px}
}
有了上次的代碼它實際上只是反覆多次,我想一個步驟,這可能嗎?
你可以Ç在javascript中使用這些動畫或使用precentages –
也許'calc(100%+ 50px)'? –
你用'javascipt'標記了這個,但正在尋找一個css解決方案。你打開一個javascript解決方案嗎?怎麼樣一個CSS預處理器? –