简体   繁体   English

CSS转换延迟不起作用

[英]CSS transition-delay not working

I am trying to make an image make itself bigger when hovering over it. 我试图让图像在悬停在它上面时变得更大。 However the transition-delay property does not seem to work. 但是, transition-delay属性似乎不起作用。 The image is loaded by an object tag, however I have also tried using the img tag. 图像由object标签加载,但我也尝试使用img标签。

Fiddle 小提琴

<div id="c_a">
<object data="https://lh6.ggpht.com/Rr2X9m8HrCIGJrOKG3MOr9pRYERaa4yBLWUTeB6YNgJVlseJSMIbFWDc9nX6O2Y9HeWRf-2qL1gy0TInmKtKfRIBAJVPK4eglImapFb9=s660" type="image/jpg"></object>
</div>

CSS: CSS:

#c_a object{
  transition: width 1s linear 2s, height 1s linear 2s;
  -webkit-transition: width 1s linear 2s, height 1s linear 2s;
  -o-transition: width 1s linear 2s, height 1s linear 2s;
  -moz-transition: width 1s linear 2s, height 1s linear 2s;
}
#c_a object:hover{
  width: 300%;
  height: 300%;
}

I had a problem where transition-delay was not working It's important to put transition-delay after transition property! 我有一个转换延迟不起作用的问题在transition属性之后放置transition-delay很重要!

transition:
transition-delay:

Give initial width and height of 100% to begin with. 首先给出初始宽度和高度100%。

#c_a object{
   width:100%;
   height:100%;
   // transitions..
}

Working Fiddle 工作小提琴

My transition-delay wasn't working either, but corbacho's solution did not do it for me. 我的transition-delay也没有奏效,但是corbacho的解决方案并没有为我做。 However, I discovered that if I change transition to transition-duration then it works! 但是,我发现如果我将transition更改为transition-duration那么它可以工作!

transition-duration:
transition-delay:

By the way, the order doesn't make a difference for me on this. 顺便说一句,订单对我没有任何影响。

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

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