0

我在 Framer.js 中进行原型设计。我有一个滚动组件和滚动内容,我正在尝试打印内容的当前 x 或 scrollX 位置。因此,如果我向右滚动 500px,代码将打印 500

Bg = new BackgroundLayer
backgroundColor: 'FFF'

scroll = new ScrollComponent 
    width: 750
    height: 1334
    scrollVertical: false

layerA = new Layer 
        width: 750 * 5
        height: 1334 
        superLayer: scroll.content

layerA.style.background = "-webkit-linear-gradient(45deg, #2AF 0%, #F00 100%)"

# get current x value of scroll content
print layerA.scrollX

成帧器演示:http ://share.framerjs.com/70pi1l6is76t/

Codepen 演示:http ://codepen.io/matter/pen/78fc798001529418123b84470ea8c625?editors=0010

先感谢您,

4

1 回答 1

2

您可以通过添加事件侦听器来打印当前的 scrollX 值:

scroll.onScroll ->
    print scroll.scrollX

有关事件的更多信息:http: //framerjs.com/docs/#events.events

更新的 Framer 演示:http ://share.framerjs.com/jvmsrtmm7i5g/

于 2016-03-11T16:32:35.133 回答