关键点
CSS resize 属性允许你控制一个元素的可 调整 大小性 配合 resize 实现子元素的动态 宽 度HT ML :
&nbs p;
<div class='picA'> <div class='picB'> <div readonly class='resizeElement'></div> </div> </div>
SCSS:
html { background: # ddd; h ei ght: 100%; width: 100%; } .picA { background -i mage: url(https://z3.ax1x .COM /2021/08/17/fhJdpQ.png); background-size : cover; width: 650px; height: 340px; border: 5px solid #f0e5ab; border-radius: 3px; box -s hadow: 0 0 1px #999, -2px 2px 3px rgba(0, 0, 0, 0.2); padding: 0; m arg in: 1rem auto; pos IT ion: relative; overflow: hidden; } .picB { background-image: url(https://z3.ax1x.com/2021/08/17/fhJUfg.png); background- Size: cover; height: 340px; position: absolute; top: 0; left: 0; min-width: 0; max-width: 650px; box-sizing: border-box; } .picB:before { content: "↔"; position: absolute; background: rgba(0, 0, 0, 0.5); font-size: 16px; color: white; top: 0; right: 0; height: 100%; line-height: 340px; } .resizeElement { resize: horizontal; overflow: scroll; opacity: 0; position: relative; top: 50%; left: 0px; height: 15px; max-width: 650px; min-width: 15px; width: 0; cursor: move; transform: scaleY(35); transform-ori gin : center center; animation: delta 5s normal ease-in-out 1s; } @keyfr am es delta { 30% { width: 0; } 60% { width: 350px; } 100% { width: 0; } }
效果如下:
到此这篇关于如何使用 resize 实现图片切换预览功能的 文章 就介绍到这了,更多相关resize 图片切换预览内容请搜索以前的文章或继续浏览下面的相关文章,希望大家以后多多支持!
总结
以上是 为你收集整理的 如何使用 resize 实现图片切换预览功能 全部内容,希望文章能够帮你解决 如何使用 resize 实现图片切换预览功能 所遇到的问题。
如果觉得 网站内容还不错, 推荐好友。
查看更多关于如何使用 resize 实现图片切换预览功能的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did201807