简体   繁体   English

过渡延迟文本不透明度

[英]transition-delay text opacity

I have a div with an image. 我有一个带图片的div。

On hover, I want to make the image bigger and to display some text next to the div. 悬停时,我想放大图像并在div旁边显示一些文本。

I want to show the text once the first transition (make the image bigger) has ended. 我想在第一个过渡(使图像变大)结束后显示文本。

I've tried a lot of things but did not manage to find any solution, here is my last try : 我已经尝试了很多方法,但是没有找到任何解决方案,这是我的最后尝试:

 .width-12 { width: 100%; height: 100%; } .change-hover { width: 10%; transition: all 1s; float: left; } .show-hover { display: none; text-align: left; opacity: 0; transition: opacity 0s; } .discover-no-hover:hover .change-hover { width: 24%; float: left; } .discover-no-hover:hover .show-hover { display: block; opacity: 1; transition-delay: 1s; } 
 <div class="width-12 discover-no-hover"> <div class="box small bkg-white"> <div class="feature-column medium mb-50 center hover-align"> <div class="iconcool"> <img src="https://upload.wikimedia.org/wikipedia/commons/4/45/Carr%C3%A9_rouge.svg" alt="" class="img-responsive change-hover"> </div> <div class="show-hover"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus semper varius elit, at efficitur lorem bibendum ac. Nulla feugiat, orci et laoreet vehicula, turpis ligula venenatis diam, bibendum porttitor odio leo ut enim. Aenean pretium tristique mattis. Maecenas ullamcorper iaculis ornare. Ut vitae luctus purus. Suspendisse tincidunt, lorem quis ultrices varius, turpis turpis pellentesque ante. </div> </div> </div> </div> 

JSfiddle for those who don't like the snippet JSfiddle适合那些不喜欢该片段的人

How can I make the text appear only after the image stopped growing ? 如何仅在图像停止增长后才显示文本? (Or after 1s, wich is the duration of the image growing)? (或者在1秒之后,图像的增长时间是多少)?

Thank you ! 谢谢 !

You have 你有

.show-hover {

    display: none;
    text-align: left;
    opacity: 0;
    transition: opacity 0s; /* this*/
}

Just amend this to 只是修改为

transition: 0s opacity 1s;

 .width-12 { width: 100%; height: 100%; } .change-hover { width: 10%; transition: all 1s; float: left; } .show-hover { display: block; text-align: left; opacity: 0; transition: 0s opacity 1s; } .discover-no-hover:hover .change-hover { width: 24%; float: left; } .discover-no-hover:hover .show-hover { display: block; opacity: 1; transition-delay: 1s; } 
 <div class="width-12 discover-no-hover"> <div class="box small bkg-white"> <div class="feature-column medium mb-50 center hover-align"> <div class="iconcool"> <img src="https://upload.wikimedia.org/wikipedia/commons/4/45/Carr%C3%A9_rouge.svg" alt="" class="img-responsive change-hover"> </div> <div class="show-hover"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus semper varius elit, at efficitur lorem bibendum ac. Nulla feugiat, orci et laoreet vehicula, turpis ligula venenatis diam, bibendum porttitor odio leo ut enim. Aenean pretium tristique mattis. Maecenas ullamcorper iaculis ornare. Ut vitae luctus purus. Suspendisse tincidunt, lorem quis ultrices varius, turpis turpis pellentesque ante. </div> </div> </div> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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