Skip to content

Instantly share code, notes, and snippets.

@ppcano
Created August 14, 2012 11:15
Show Gist options
  • Save ppcano/3348263 to your computer and use it in GitHub Desktop.
Save ppcano/3348263 to your computer and use it in GitHub Desktop.
Ember Gesture does not avoid to bubble up.
<!-- id = touch-test -->
{{#view Yvi.TouchHoldView id="hold" }}
<div id="hold-scroller">
<div id="hold-scroller-container">
<div/><div/><div/><div/><div/><div/><div/><div/>
<div/><div/><div/><div/><div/><div/><div/><div/>
</div>
</div>
{{/view }}
Yvi.TouchHoldView = Em.View.extend({
touchHoldOptions: {
holdPeriod: 200,
moveThreshold: 40
},
classNameBindings: ['isOn'],
isOn: true,
touchHoldEnd: function(recognizer) {
this.set('isOn', !this.get('isOn') );
}
});
Yvi.ExampleView = Em.View.extend({
elementId: 'touch-test',
templateName: 'example'
});
#touch-test {
position: absolute;
left: 0;
top: 0;
bottom: 0;
height: 100%;
width: 100%;
overflow: hidden;
}
#hold {
position: relative;
width: 100%;
background-color: yellow;
}
#hold.is-on {
background-color: purple;
}
#hold-scroller {
overflow-y: auto !important;
-webkit-overflow-scrolling: touch;
}
#hold-scroller-container {
width: 100%;
height: 80px;
}
#hold-scroller-container > div {
width: 100%;
height: 20px;
}
#hold-scroller-container > div:nth-child(even) {
background-color: red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment