如何使用GreenSock和ScrollMagic在每个循环中定位子项

时间:2017-11-15 05:21:11

标签: javascript greensock gsap scrollmagic

我希望能够通过使用each()循环让每个div与.fade-in目标的子类h1(向右滑动)和span(向左滑动)。所以我的问题是我如何使用'this'来定位子元素,例如tl.from('.fade-in h1', 1, {x: 300})将.fade-in替换为“this”?

tl
  .from(
    ".fade-in h1",
    0.3,
    { autoAlpha: 0, scale: 0.5, x: 300, ease: Linear.easeNone },
    "x"
  )
  .from(
    ".fade-in span",
    0.3,
    { autoAlpha: 0, scale: 0.5, x: -300, color: "red", ease: Linear.easeNone },
    "x"
  );

Demo Link

1 个答案:

答案 0 :(得分:1)

试试这个

检查演示Here

Ext.define('MyDataView', {
    extend: 'Ext.dataview.DataView',
    
    config: {
        /* do not set here
        plugins: [{
            xclass: 'Ext.plugin.ListPaging',
            autoPaging: true
        }, {
            xclass: 'Ext.plugin.PullRefresh'
        }]
        */
    },

    initialize: function() {
        var me = this;

        me.callParent();

        // Initialize plugin here, so the listpaging component will append after dataview container
        me.setPlugins([{
            xclass: 'Ext.plugin.ListPaging',
            autoPaging: true
        }, {
            xclass: 'Ext.plugin.PullRefresh'
        }]);
    }
}
相关问题