Created
September 23, 2014 15:21
-
-
Save martypdx/c64ecf6f6e98d40bbb2f to your computer and use it in GitHub Desktop.
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
<!-- {{>box}}--> | |
<div class='box' | |
style="top: {{ pos.top }}px; | |
height: 200px; | |
width: 300px;"> | |
</div> | |
<!-- {{/box}} --> | |
{{#box1}} | |
{{>box}} | |
<input type="range" class='h' | |
max="{{size.height}}" | |
value="{{ pos.top }}" | |
style="left: {{ pos.left }}px; | |
width: {{size.height + thumb}}px; | |
top: {{-thumb/2}}px; | |
transform-origin: {{thumb/2}}px"/> | |
{{/}} | |
<p>{{ JSON.stringify(pos) }}</p> | |
<style> | |
.h { | |
position: absolute; | |
transform: rotateZ(90deg); | |
transform-origin: 0 0; | |
border: 0; margin: 0; | |
} | |
.box { | |
position: absolute; | |
background: lightgreen; | |
} | |
p { | |
float: right; | |
} | |
</style> | |
<script> | |
var r = new Ractive({ | |
el: document.body, | |
template: '#template', | |
data: { | |
thumb: 14, | |
box1: { | |
pos: { | |
left: 50, | |
top: 0 | |
}, | |
size: { | |
width: 300, | |
height: 200 | |
} | |
}, | |
box2: { | |
pos: { | |
left: 50, | |
top: 300 | |
}, | |
size: { | |
width: 300, | |
height: 200 | |
} | |
} | |
} | |
}) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment