.box { display:flex; position:relative; height:100px; margin-left:100px; position:relative; } .round { width:50px; height:50px; border-radius:50%; display:flex; align-items:center; justify-content:center; position:absolute; top:0; opacity:0; } .color1 { background-color:#f00; } .color2 { background-color:#f0f; } .color3 { background-color:#ff0; } .color4 { background-color:#00f; } .color5 { background-color:#0f0; } .color6 { background-color:#0ff; } .round:nth-child(1) { transition:all 1s ease-in-out; left:0; opacity:0; z-index:5; } .round:nth-child(2) { transition:all 0.8s ease-in-out; left:100px; opacity:1; z-index:4; } .round:nth-child(3) { transition:all 0.8s ease-in-out; left:120px; opacity:1; z-index:3; } .round:nth-child(4) { transition:all 0.8s ease-in-out; left:140px; opacity:1; z-index:2; } .round:nth-child(5) { transition:all 0.8s ease-in-out; left:160px; opacity:1; z-index:1; } .round:nth-child(n+6) { transition:all 0.8s ease-in-out; opacity:0; z-index:0; } .btn { background-color:#f00; color:#fff; padding:20px; margin-bottom:10px; cursor:pointer; }
更新时间:2023-11-13 08:11:30
主要用于文章头像浏览展示
// 修改此仍需改默认样式 否则默认显示和动画不匹配 const obj = { width:100,//宽度 time:2000,//毫秒 num:3,//展示几个 interval:20, }