简体   繁体   中英

How do I achieve this hover linear wipe transition in CSS/JS?

I should also mention that I can't just put one image on top of the other since I'll also work with transparent images. linear wipe preview

You don't need js nor external libraries for this particular effect at all.

 .container{ width: 50%; height: 200px; position: relative; border: 2px solid red; }.underlay{ width: 100%; height: 100%; background: lightblue; }.overlay{ position: absolute; right: 0; top: 0; width: 0; height: 100%; background: pink; transition: 300ms; }.container:hover.overlay{ width: 100%; }
 <div class='container'> <div class='underlay'></div> <div class='overlay'></div> </div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM