小编Did*_*ero的帖子

隐藏后的CSS无限动画未重置(Chrome)

这里我有一个CSS关键帧动画的例子(你可以在这个Demo上看到整个事情)

代码将每1.4秒将img缩放到0.75并返回其原始(1)比例.这很好.

然后我添加一个简单的jQuery代码来模拟错误:

setTimeout(function () {
    $("img").css('visibility', 'hidden');
    activate();
}, 3000);

function activate() {
    setTimeout(function () {
        $("img").css('visibility', 'visible');
    }, 3000);
}
Run Code Online (Sandbox Code Playgroud)
@-webkit-keyframes imagebulger {
    to {
        -webkit-transform: scale(.75);
        transform: scale(.75);
    }
}
@keyframes imagebulger {
    to {
        -webkit-transform: scale(.75);
        transform: scale(.75);
    }
}
img {
    -webkit-animation: imagebulger 1.4s infinite alternate;
    -moz-animation: imagebulger 1.4s infinite alternate;
    -o-animation: imagebulger 1.4s infinite alternate;
    animation: imagebulger 1.4s infinite alternate;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<img src="http://placehold.it/200x200" />
Run Code Online (Sandbox Code Playgroud)

这将在3秒后和3秒内隐藏img元素.当img元素返回到可见时,调整大小效果将不再运行.

它发生在Chrome 41.0.2272(Ubuntu)中.在Firefox中它按预期工作.


编辑

看起来像是Chrome中的错误.我开了一个问题.作为一种解决方法,如建议,在设置后使用 …

css google-chrome css3 css-animations

6
推荐指数
1
解决办法
997
查看次数

具有关键帧和背景大小属性的CSS3动画在Chrome 51中无效

我有一段类似于本例中的代码.基本上有一些keyFrames(0%和100%)将background-size属性设置为100%,而keyFrame 50%将该属性设置为50%.

@keyframes imagebulger {
  0%,
  100% {
    background-size: 100% auto;
  }
  50% {
    background-size: 50% auto;
  }
}

div.hotspot {
  width: 200px;
  height: 100px;
  background-image: url("http://dummyimage.com/200x100/000/fff");
  background-repeat: no-repeat;
  animation: imagebulger 2s infinite !important;
}
Run Code Online (Sandbox Code Playgroud)
<div class="hotspot"></div>
Run Code Online (Sandbox Code Playgroud)

该示例在Chrome <51,Firefox,IE 11等中按预期工作(执行转换).但是,在Chrome更新(51.0.2704.63)之后,它不再起作用了.我在Windows计算机和Linux计算机上尝试过相同的结果.

有这个问题的人找到了解决方法吗?否则我会直接发布Chrome错误

与问题相关的问题Chrome 51中的背景大小转换 - 错误或功能?,似乎它使用前缀属性,但没有它,这根本没有意义.

这个版本可以使用,但是我被迫将前缀-webkit-设置为普通的关键帧,这可能会使这个动画在其他浏览器中不起作用.我不认为这是一个公认的解决方案.

css css3 css-animations

5
推荐指数
1
解决办法
4530
查看次数

反射将非空属性从一个对象复制到另一个 BeanUtils

有这个:

public class Parent {
    private String name;
    private int age;
    private Date birthDate;
    private Work work;
    static class Work{
        private int years;
        private String employer;
    }

// getters and setters   
    public static void main(String[] args) {
        Parent c = new Parent;
        c.setAge(55)
        Work work=new Parent.Work();
        work.setEmployer("Example");
        c.setWork(work);
        //save c in a DB...
    }
}
Run Code Online (Sandbox Code Playgroud)

我只想使用反射复制非空属性。该方法在这里描述与BeanUtils的作品非常好,但它会将所有没有空包装的对象,而不仅仅是没有空字段值:

//fetch c from the db...
Parent sameParent= new Parent;
sameParent.setWork(new Parent.Work());
//Directly from /sf/ask/91118821/#answer-3521314
BeanUtilsBean notNull=new NullAwareBeanUtilsBean();
notNull.copyProperties(c, sameParent);
Run Code Online (Sandbox Code Playgroud)

现在, …

java apache-commons-beanutils

2
推荐指数
1
解决办法
4315
查看次数