Skip to content

Instantly share code, notes, and snippets.

@adamjmcgrath
Created July 15, 2016 14:10
Show Gist options
  • Save adamjmcgrath/6b552d12103e4092af66fe45a0489d39 to your computer and use it in GitHub Desktop.
Save adamjmcgrath/6b552d12103e4092af66fe45a0489d39 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
Ember.testing = true;
export default Ember.Component.extend({
attributeBindings: ['style'],
style: 'height: 100px; overflow: auto;',
content: Ember.computed(function() {
return 'foo';
}),
didInsertElement: function() {
this.$().scroll(function() {
Ember.run.once(Ember.K);
});
},
actions: {
scroll: function() {
this.$().scrollTop(Math.random() * 500)
},
safeScroll: function() {
Ember.run.begin();
this.$().one('scroll', Ember.run.end)
.scrollTop(Math.random() * 500);
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<div style="position: fixed">
<button {{ action "safeScroll" }}>Safe scroll</button>
<button {{ action "scroll" }}>scroll</button>
</div>
<div style="height: 500px; background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(0,0,0,1) 100%);"></div>
{
"version": "0.10.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.6.0",
"ember-data": "2.6.1",
"ember-template-compiler": "2.6.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment