Last active
August 29, 2015 14:10
-
-
Save akarve/0ec2bbabb34ee8eb3292 to your computer and use it in GitHub Desktop.
Framer JS draggable inside scrollVertical Layer (works on desktop, does not work on mobile)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bg = new BackgroundLayer backgroundColor:"black" | |
scroll_panel = new Layer | |
height: bg.height | |
width: bg.width | |
backgroundColor: "transparent" | |
scroll_panel.scrollVertical = true | |
scroll_content = new Layer | |
width: bg.width | |
backgroundColor: "black" | |
superLayer: scroll_panel | |
item_dim = | |
width: bg.width | |
stroke_width: 1 | |
height: 100 | |
count: 23 | |
for i in [0..(item_dim.count - 1)] | |
item = new Layer | |
width: item_dim.width | |
height: item_dim.height | |
y: i * (item_dim.height) | |
backgroundColor: "orange" | |
opacity: 0.8 | |
superLayer: scroll_content | |
item.hueRotate = i * 10 | |
item.style = | |
borderBottom: item_dim.stroke_width + "px solid white" | |
borderTop: item_dim.stroke_width + "px solid white" | |
knob = new Layer | |
width: 50 | |
height: item_dim.height | |
backgroundColor: "white" | |
opacity: 0.5 | |
superLayer: item | |
knob.center() | |
knob.draggable.enabled = true | |
knob.draggable.speedY = 0 | |
#knob.draggable.maxDragFrame = item.frame | |
scroll_content.height = item_dim.count * (item_dim.height) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment