mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
Swipe left for list items in the works
This commit is contained in:
36
js/views/listView.js
Normal file
36
js/views/listView.js
Normal file
@ -0,0 +1,36 @@
|
||||
(function(ionic) {
|
||||
|
||||
ionic.views.List = function(opts) {
|
||||
var _this = this;
|
||||
|
||||
this.el = opts.el;
|
||||
|
||||
window.ionic.onGesture('swipeleft', function(e) {
|
||||
_this._handleSwipeLeft(e);
|
||||
}, this.el);
|
||||
|
||||
window.ionic.onGesture('swiperight', function(e) {
|
||||
_this._handleSwipeRight(e);
|
||||
}, this.el);
|
||||
};
|
||||
|
||||
ionic.views.List.prototype = {
|
||||
_handleSwipeLeft: function(e) {
|
||||
var item = e.target;
|
||||
if(!item.classList.contains('list-item')) {
|
||||
return;
|
||||
}
|
||||
|
||||
item.classList.add('slide-left');
|
||||
},
|
||||
_handleSwipeRight: function(e) {
|
||||
var item = e.target;
|
||||
if(!item.classList.contains('list-item')) {
|
||||
return;
|
||||
}
|
||||
|
||||
item.classList.remove('slide-left');
|
||||
}
|
||||
};
|
||||
|
||||
})(ionic);
|
||||
Reference in New Issue
Block a user