【问题标题】:css3 columns + responsive layouts: animate item position changes.using css3 or jquery/javascriptcss3 列 + 响应式布局:动画项目位置更改。使用 css3 或 jquery/javascript
【发布时间】:2013-05-09 18:50:17
【问题描述】:

我正在创建一个砖石风格的布局,但使用 css3 代替列,因为它允许我更轻松、更精确地构建布局,尤其是因为我正在构建响应式布局。

现在,我正在使用 css3 媒体查询来根据窗口大小更改显示的列数。我想要做的是当列数随着窗口大小的变化而变化时,在列之间的列元素的位置变化动画。

这是我的一些 css 代码:

@media all and (min-width: 961px) and (max-width: 1599px){
    #portfolio {
        width:100%;
        position:relative;
        text-align:center;
        -moz-column-count:4;
        -moz-column-gap:3px;
        -webkit-column-count:4;
        -webkit-column-gap:3px;
        column-count:4;
        column-gap:3px;
    }
}
@media all and (min-width: 1600px){
    #portfolio {
        width:100%;
        position:relative;
        text-align:center;
        -moz-column-count:5;
        -moz-column-gap:3px;
        -webkit-column-count:5;
        -webkit-column-gap:3px;
        column-count:5;
        column-gap:3px;
    }
}

有人知道如何处理吗? TIA。

【问题讨论】:

    标签: jquery css animation transition multiple-columns


    【解决方案1】:

    查看动画属性:

    /* Animation Property */
    animation-property: width;
    animation-property: height;
    transition-duration: 1s;
    /* webkit */
    -webkit-animation-property: width;
    -webkit-animation-property: height;
    -webkit-transition-duration: 1s;
    /* moz */
    -moz-animation-property: width;
    -moz-animation-property: height;
    -moz-transition-duration: 1s;
    /* opera */
    -o-animation-property: width;
    -o-animation-property: height;
    -o-transition-duration: 1s;
    

    示例:http://theboywhocriedfox.com/demo/animate-transitions-with-media-queries/

    【讨论】:

    • 这不适用于columns 属性。它仅在您明确更改 width 或 height 时才有效。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-04
    • 2017-10-09
    • 2011-11-08
    • 2012-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多