JSFiddle - React, Tailwind, and code Playground
by rich_harris
HTML
<script src="https://rawgit.com/ractivejs/ractive-transitions-slide/master/ractive-transitions-slide.js"></script>
<main></main>
<script id='template' type='text/ractive'>
<button on-click='cycle()'>cycle</button>
<div class='video-container'>
{{#if foo}}
<p decorator='d'></p>
{{/if}}
</div>
</script>
CSS
body {
font-family: 'Helvetica Neue', arial, sans-serif;
font-weight: 200;
color: #353535;
}
h1, h2, h3, h4, h5, h6 {
font-weight: 200;
}
.error {
color: #d00;
font-family: monospace;
}
.video-container {
position: relative;
width: 100%;
padding: 0 0 56.25% 0;
text-align: center;
}
button {
margin: 0 0 1em 0;
}
video, .loading {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.loading {
background-color: #eee;
text-align: center;
}
.loading span {
position: absolute;
width: 100%;
left: 0;
top: 50%;
transform: translate(0,-50%);
}
JavaScript
var ractive = new Ractive({
el: 'main',
template: '#template',
data: {
foo: null
},
cycle: function () {
console.group( 'cycle' );
this.set( 'foo', null );
this.set( 'foo', true );
console.groupEnd();
},
decorators: {
d: function ( node ) {
return {
update: function ( src ) {
console.log( 'update' );
},
teardown: function () {
console.log( 'teardown' );
}
};
}
}
});