mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
Swipe left for list items in the works
This commit is contained in:
53
dist/ionic.js
vendored
53
dist/ionic.js
vendored
@ -177,7 +177,7 @@ window.ionic = {
|
||||
* Simple gesture controllers with some common gestures that emit
|
||||
* gesture events.
|
||||
*
|
||||
* Ported from github.com/EightMedia/hammer.js - thanks!
|
||||
* Ported from github.com/EightMedia/ionic.Gestures.js - thanks!
|
||||
*/
|
||||
(function(ionic) {
|
||||
|
||||
@ -265,17 +265,9 @@ window.ionic = {
|
||||
ionic.Gestures.event.determineEventTypes();
|
||||
|
||||
// Register all gestures inside ionic.Gestures.gestures
|
||||
if(this === this.window) {
|
||||
// this is a window, then only allow the Tap gesture to be added
|
||||
ionic.Gestures.detection.register(ionic.Gestures.gestures.Tap);
|
||||
ionic.Gestures.detection.register(ionic.Gestures.gestures.Drag);
|
||||
ionic.Gestures.detection.register(ionic.Gestures.gestures.Release);
|
||||
} else {
|
||||
// everything else but the window
|
||||
for(var name in ionic.Gestures.gestures) {
|
||||
if(ionic.Gestures.gestures.hasOwnProperty(name)) {
|
||||
ionic.Gestures.detection.register(ionic.Gestures.gestures[name]);
|
||||
}
|
||||
for(var name in ionic.Gestures.gestures) {
|
||||
if(ionic.Gestures.gestures.hasOwnProperty(name)) {
|
||||
ionic.Gestures.detection.register(ionic.Gestures.gestures[name]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1784,6 +1776,43 @@ window.ionic = {
|
||||
}
|
||||
};
|
||||
|
||||
})(ionic);
|
||||
;
|
||||
(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);
|
||||
;
|
||||
(function(ionic) {
|
||||
|
||||
Reference in New Issue
Block a user