我正在嘗試使「卡」可以在Ionic中左右滑動。 我發現一個教程,使列表項可以滑動到左側,然後顯示右邊的按鈕:https://blog.nraboy.com/2014/12/make-list-items-swipeable-ionic-framework/1如何在Ionic中製作swipable卡(左側或右側)?
我的問題是:是否有可能讓我們使'卡'可以滑動到左側(並顯示右側的選項按鈕),也可以向右滑動(並顯示左側的選項按鈕)?
對於我的樣品筆,而我用離子名單的工作,請click here
的JavaScript:
angular.module('navTest', ['ionic'])
.controller('TestCtrl', function($scope, $timeout, $ionicSideMenuDelegate) {
$scope.toggleLeft = function() {
$ionicSideMenuDelegate.toggleLeft();
};
// Build Mock Data
$scope.items = [
{ from: 'De gea', face: 'https://pbs.twimg.com/profile_images/605749112437387264/LcJGIoOC_400x400.jpg', text: 'Manchester United' },
{ from: 'Iker Casillas', face: 'https://pbs.twimg.com/profile_images/596339467419557888/8Ik_gZLy_400x400.jpg', text: 'Real Madrid' },
{ from: 'Thibaut Courtuis', face: 'https://pbs.twimg.com/profile_images/509399022797615104/_8tezi0H_400x400.jpeg', text: 'Chelsea' },
{ from: 'Manuel Neuer', face: 'https://pbs.twimg.com/profile_images/471230204036145152/tZzWfQxH_400x400.jpeg', text: 'Bayern Munich' },
{ from: 'Joe hart', face: 'https://pbs.twimg.com/profile_images/602513436069724160/6IEAKTGy_400x400.jpg', text: 'Manchester City' }
];
// List Toggles
$scope.itemClick = function() {
console.info('itemClick');
document.getElementById('click-notify').style.display = 'block';
setTimeout(function(){
document.getElementById('click-notify').style.display = 'none';
}, 500);
};
// Item Methods/Properties
$scope.deleteItem = function(item, index) {
console.log('onDelete from the "item" directive on-delete attribute. Lets not delete this item today ok!', item, index);
};
$scope.deleteListItem = function(item, index) {
console.log('onDelete from the "list" on-delete attribute', item, index);
$scope.items.splice(index, 1);
};
$scope.onReorder = function(el, start, end) {
console.log('On reorder', el, start, end);
};
$scope.optionButtons1 = [
{
text: 'Add to Wishlist',
type: 'button-positive',
onTap: function(item, button) { alert(button.text + ' Button: ' + item.text) }
},
{
text: 'Buy Now!',
type: 'button-balanced',
onTap: function(item, button) { alert(button.text + ' Button: ' + item.text) }
}
];
$scope.optionButtons2 = [
{
text: 'Cancel',
onTap: function() { alert('CANCEL!') }
},
{
text: 'Submit',
onTap: function() { alert('SUBMIT!') }
}
];
$scope.urlItems = [
{ text: 'Biography', icon: 'ion-person', url: 'http://en.wikipedia.org/wiki/Nicolas_Cage' },
{ text: 'Fan Club', icon: 'ion-star', url: 'http://cagealot.com/', isActive: true }
];
});
任何意見將不勝感激。
你弄清楚如何使一個「卡」可以滑動到在離子左右? – Yatin