javascript - css輪播圖適應布局問題
問題描述
問題解答
回答1:純靠CSS就可以實現類似效果:
HTML:<body style=’margin: 0;’> <p style=’position: absolute;width: 40%;height: 100%;background-color: blue;overflow: hidden;’><p style=’position: absolute;width: 100%;height: 80%;background-color: orange;top: 10%;left: 200%;’></p><p style=’position: absolute;width: 100%;height: 80%;background-color: green;top: 10%;left: 200%;’></p><p style=’position: absolute;width: 100%;height: 80%;background-color: red;top: 10%;left: 200%;’></p> </p></body>
CSS:.p1{ animation: pleft 6s infinite linear; -webkit-animation: pleft 6s infinite linear; animation-fill-mode: both; -webkit-animation-fill-mode: both;}@keyframes pleft{ 0%{left: 200%} 100%{left: -100%}}.p2{ animation: pmid 6s infinite linear; -webkit-animation: pmid 6s infinite linear; animation-fill-mode: both; -webkit-animation-fill-mode: both; animation-delay:2s; -webkit-animation-delay:2s;}@keyframes pmid{ 0%{left: 200%} 100%{left: -100%}}.p3{ animation: pright 6s infinite linear; -webkit-animation: pright 6s infinite linear; animation-fill-mode: both; -webkit-animation-fill-mode: both; animation-delay:4s; -webkit-animation-delay:4s;}@keyframes pright{ 0%{left: 200%} 100%{left: -100%}}
jsfiddle.net看看是不是你想要的
回答2:想了兩種方法: flex 與 inline-block容器設了寬度是為了便于觀察.按理來說用定位也是可以的.但是得一個一個設置定位, 就沒弄了.
https://jsfiddle.net/m41tLwqb/1/https://jsfiddle.net/2zcqqj26/
回答3:曾用純CSS做輪播,至于你說的這個,應該能實現,但自己沒做過,沒法肯定
相關文章:
1. java - Oracle如何獲取去重結果集中某一條數據的下一條數據2. javascript - 求正則表達式的寫法3. mysql scripts提示 /usr/bin/perl: bad interpreter4. python - 數據無法插入到mysql表里5. npm install -g browser-sync這個之后出錯 還有人嗎 我都感覺沒人回答問題了6. python - pyspider的分布式運行成功,2臺slave跑,但是時間并沒有縮短問題?7. atom開始輸入!然后按tab只有空格出現沒有html格式出現8. ubuntu - elasticsearch-head插件安裝后,啟動問題!9. javascript - 小程序跳轉失敗?10. 致命錯誤: Class ’appfacadeTest’ not found
