我正在 Framer.js 中进行原型(prototype)设计。我有一个滚动组件和滚动内容,我正在尝试打印内容的当前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
提前谢谢您,
最佳答案
您可以通过添加事件监听器来打印当前的scrollX值:
scroll.onScroll ->
print scroll.scrollX
有关事件的更多信息:http://framerjs.com/docs/#events.events
更新了 Framer 演示:http://share.framerjs.com/jvmsrtmm7i5g/
关于javascript - 在 Framer.js 中打印滚动位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35856561/