Skip to content

Instantly share code, notes, and snippets.

@tabiodun
Forked from k-fish/controllers.application.js
Last active July 31, 2018 20:30
Show Gist options
  • Save tabiodun/0b3838214c59048ac67da0dcc276ee91 to your computer and use it in GitHub Desktop.
Save tabiodun/0b3838214c59048ac67da0dcc276ee91 to your computer and use it in GitHub Desktop.
Flex box margin transition
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
toggle() {
this.toggleProperty('isIn');
}
}
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
.either {
transition: all 0.5s ease-in-out;
}
.in {
margin-left: -200px;
}
.out {
margin-left: 100px;
}
<h1>Slidin</h1>
<br>
<br>
{{outlet}}
<div style="display: flex; justify-content: space-around">
<div style="border: 1px solid #000; width: 100px; height: 100px; width: 800px; height: 1000px; background-color: blue"></div>
<div style="width: 200px">
<div style="border: 1px solid #000; width: 100px; height: 100px; background-color: red" class="either {{if isIn 'in' 'out'}}">
<button {{action 'toggle'}}>
Click
</button>
</div>
</div>
</div>
<br>
<br>
{
"version": "0.15.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.2.2",
"ember-template-compiler": "3.2.2",
"ember-testing": "3.2.2"
},
"addons": {
"ember-data": "3.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment