操纵背景图像径向过渡不适用于铬?

Bry*_*der 2 css transition google-chrome css-transitions

我已经在纯粹的css中创建了一个涟漪效果,之前在所有浏览器中都运行得很好,现在看起来它目前在chrome中不起作用但在其他浏览器中正常工作(不包括IE,我不测试那个垃圾)好奇至于为什么会这样?我已经耗尽了我的资源,因为它现在正在使用chrome进行工作.

<a href="javascript:void(0)" class="btn-shadow btn-ripple">Button</a>

[class^="btn"],
[class*=" btn"]
    display inline-flex
    font-family 'Roboto', sans-serif
    text-decoration none
    justify-content center
    align-items center
    text-align center
    cursor pointer
    white-space nowrap
    padding 8px 20px
    font-size 14px
    background-color white
    border-radius 2px
    color #434A54
    text-transform uppercase
    border none
    box-shadow 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24)
    transition all 0.4s ease-in-out
    background-position 50%
    outline none !important // we don't like outlines, nasty hobbits...
    &:before {
        content: '';
        position: absolute;
        background: red;
    }
    &:not([disabled])
        &.btn-shadow
            &:active
                box-shadow 0 5px 10px rgba(0,0,0,0.19), 0 2px 2px rgba(0,0,0,0.23)
        &.btn-ripple
            transition all 0.4s ease-in-out
            background-size 200%
            &:active
                background-repeat no-repeat
                background-size 1000%
                background-image radial-gradient(circle, rgba(0, 0, 0, .1) 10%, rgba(0, 0, 0, 0) 11%)
Run Code Online (Sandbox Code Playgroud)

看到它发生在这里:http: //codepen.io/brycesnyder/pen/gPojeO?editors = 1100

谢谢!

wic*_*k3d 5

你的问题非常有趣.

看看Firefox和Chrome,我能够重现你所描述的内容.

在阅读W3schools中的background-size 属性文档后,我找到了最简单的解决方案

您忘记定义新背景大小值的x和y维度

试试这个:

&.btn-ripple
    transition all 0.4s ease-in-out
    background-size 200% 200%
&:active
    background-repeat no-repeat
    background-size 1000% 1000%
Run Code Online (Sandbox Code Playgroud)

将这些值添加到您附加的Codepen中,我能够在Chrome 51中正确地看到过渡.

希望这可以帮助