mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
Scroll stuff
This commit is contained in:
23
dist/css/ionic-ios7.css
vendored
23
dist/css/ionic-ios7.css
vendored
@ -370,6 +370,14 @@ body, .ionic-body {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
-webkit-overflow-scrolling: touch; }
|
-webkit-overflow-scrolling: touch; }
|
||||||
|
|
||||||
|
.scroll-content {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
overflow: hidden; }
|
||||||
|
|
||||||
.has-header {
|
.has-header {
|
||||||
top: 44px; }
|
top: 44px; }
|
||||||
|
|
||||||
@ -1456,6 +1464,21 @@ button.item-button-right:after {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 0; }
|
border-radius: 0; }
|
||||||
|
.item-drag .button .icon, .item-drag .button i {
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: -moz-flex;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-box-align: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
-webkit-align-items: center;
|
||||||
|
-moz-align-items: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 24px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
height: 100%; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The hidden right-side buttons that can be exposed under a list item
|
* The hidden right-side buttons that can be exposed under a list item
|
||||||
|
|||||||
22
dist/css/ionic-scoped.css
vendored
22
dist/css/ionic-scoped.css
vendored
@ -1793,6 +1793,13 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
-webkit-overflow-scrolling: touch; }
|
-webkit-overflow-scrolling: touch; }
|
||||||
|
.ionic .scroll-content {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
overflow: hidden; }
|
||||||
.ionic .has-header {
|
.ionic .has-header {
|
||||||
top: 44px; }
|
top: 44px; }
|
||||||
.ionic .has-footer {
|
.ionic .has-footer {
|
||||||
@ -2793,6 +2800,21 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 0; }
|
border-radius: 0; }
|
||||||
|
.ionic .item-drag .button .icon, .ionic .item-drag .button i {
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: -moz-flex;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-box-align: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
-webkit-align-items: center;
|
||||||
|
-moz-align-items: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 24px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
height: 100%; }
|
||||||
.ionic .item-options {
|
.ionic .item-options {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|||||||
23
dist/css/ionic.css
vendored
23
dist/css/ionic.css
vendored
@ -2201,6 +2201,14 @@ body, .ionic-body {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
-webkit-overflow-scrolling: touch; }
|
-webkit-overflow-scrolling: touch; }
|
||||||
|
|
||||||
|
.scroll-content {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
overflow: hidden; }
|
||||||
|
|
||||||
.has-header {
|
.has-header {
|
||||||
top: 44px; }
|
top: 44px; }
|
||||||
|
|
||||||
@ -3351,6 +3359,21 @@ button.item-button-right:after {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 0; }
|
border-radius: 0; }
|
||||||
|
.item-drag .button .icon, .item-drag .button i {
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: -moz-flex;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-box-align: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
-webkit-align-items: center;
|
||||||
|
-moz-align-items: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 24px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
height: 100%; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The hidden right-side buttons that can be exposed under a list item
|
* The hidden right-side buttons that can be exposed under a list item
|
||||||
|
|||||||
30
dist/js/ionic-angular.js
vendored
30
dist/js/ionic-angular.js
vendored
@ -508,6 +508,9 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
</div>\
|
</div>\
|
||||||
<div class="item-content slide-left" ng-transclude>\
|
<div class="item-content slide-left" ng-transclude>\
|
||||||
</div>\
|
</div>\
|
||||||
|
<div class="item-drag" ng-if="canReorder && isEditing">\
|
||||||
|
<button data-ionic-action="reorder" class="button button-icon"><i ng-class="reorderIcon"></i></button>\
|
||||||
|
</div>\
|
||||||
<div class="item-options" ng-if="canSwipe && !isEditing && showOptions">\
|
<div class="item-options" ng-if="canSwipe && !isEditing && showOptions">\
|
||||||
<button ng-click="buttonClicked(button)" class="button" ng-class="button.type" ng-repeat="button in buttons">{{button.text}}</button>\
|
<button ng-click="buttonClicked(button)" class="button" ng-class="button.type" ng-repeat="button in buttons">{{button.text}}</button>\
|
||||||
</div>\
|
</div>\
|
||||||
@ -588,7 +591,10 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
|
|
||||||
compile: function(element, attr, transclude) {
|
compile: function(element, attr, transclude) {
|
||||||
return function($scope, $element, $attr) {
|
return function($scope, $element, $attr) {
|
||||||
var lv = new ionic.views.List({el: $element[0]});
|
var lv = new ionic.views.ListView({
|
||||||
|
el: $element[0],
|
||||||
|
listEl: $element[0].children[0]
|
||||||
|
});
|
||||||
|
|
||||||
if(attr.animation) {
|
if(attr.animation) {
|
||||||
$element.addClass(attr.animation);
|
$element.addClass(attr.animation);
|
||||||
@ -916,6 +922,28 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges
|
|||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description
|
||||||
|
* The scroll directive lets you enable a content area for
|
||||||
|
* our custom momentum scrolling area. The benefit to a custom
|
||||||
|
* scroll area is configurability, and avoidance of the
|
||||||
|
* buggy -webkit-overflow-scrolling: touch.
|
||||||
|
*/
|
||||||
|
|
||||||
|
angular.module('ionic.ui.scroll', [])
|
||||||
|
|
||||||
|
.directive('scroll', function() {
|
||||||
|
return {
|
||||||
|
restrict: 'ECA',
|
||||||
|
replace: true,
|
||||||
|
transclude: true,
|
||||||
|
template: '<div class="scroll-content" ng-transclude></div>'
|
||||||
|
};
|
||||||
|
});
|
||||||
|
;
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description
|
* @description
|
||||||
* The sideMenuCtrl lets you quickly have a draggable side
|
* The sideMenuCtrl lets you quickly have a draggable side
|
||||||
|
|||||||
11
dist/js/ionic.js
vendored
11
dist/js/ionic.js
vendored
@ -3012,13 +3012,6 @@ window.ionic = {
|
|||||||
// Start the drag states
|
// Start the drag states
|
||||||
this._initDrag();
|
this._initDrag();
|
||||||
|
|
||||||
// Listen for drag and release events
|
|
||||||
window.ionic.onGesture('drag', function(e) {
|
|
||||||
_this._handleDrag(e);
|
|
||||||
}, this.el);
|
|
||||||
window.ionic.onGesture('release', function(e) {
|
|
||||||
_this._handleEndDrag(e);
|
|
||||||
}, this.el);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ionic.views.List.prototype = {
|
ionic.views.List.prototype = {
|
||||||
@ -3053,6 +3046,8 @@ window.ionic = {
|
|||||||
|
|
||||||
this._isDragging = false;
|
this._isDragging = false;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
// Check if this is a reorder drag
|
// Check if this is a reorder drag
|
||||||
if(ionic.DomUtil.getParentOrSelfWithClass(e.target, 'list-item-drag') && (e.gesture.direction == 'up' || e.gesture.direction == 'down')) {
|
if(ionic.DomUtil.getParentOrSelfWithClass(e.target, 'list-item-drag') && (e.gesture.direction == 'up' || e.gesture.direction == 'down')) {
|
||||||
var item = this._getItem(e.target);
|
var item = this._getItem(e.target);
|
||||||
@ -3090,6 +3085,7 @@ window.ionic = {
|
|||||||
|
|
||||||
_handleEndDrag: function(e) {
|
_handleEndDrag: function(e) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
return false;
|
||||||
|
|
||||||
if(!this._dragOp) {
|
if(!this._dragOp) {
|
||||||
this._initDrag();
|
this._initDrag();
|
||||||
@ -3106,6 +3102,7 @@ window.ionic = {
|
|||||||
*/
|
*/
|
||||||
_handleDrag: function(e) {
|
_handleDrag: function(e) {
|
||||||
var _this = this, content, buttons;
|
var _this = this, content, buttons;
|
||||||
|
return false;
|
||||||
|
|
||||||
if(!this._dragOp) {
|
if(!this._dragOp) {
|
||||||
this._startDrag(e);
|
this._startDrag(e);
|
||||||
|
|||||||
8
js/ext/angular/src/directive/ionicList.js
vendored
8
js/ext/angular/src/directive/ionicList.js
vendored
@ -24,6 +24,9 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
</div>\
|
</div>\
|
||||||
<div class="item-content slide-left" ng-transclude>\
|
<div class="item-content slide-left" ng-transclude>\
|
||||||
</div>\
|
</div>\
|
||||||
|
<div class="item-drag" ng-if="canReorder && isEditing">\
|
||||||
|
<button data-ionic-action="reorder" class="button button-icon"><i ng-class="reorderIcon"></i></button>\
|
||||||
|
</div>\
|
||||||
<div class="item-options" ng-if="canSwipe && !isEditing && showOptions">\
|
<div class="item-options" ng-if="canSwipe && !isEditing && showOptions">\
|
||||||
<button ng-click="buttonClicked(button)" class="button" ng-class="button.type" ng-repeat="button in buttons">{{button.text}}</button>\
|
<button ng-click="buttonClicked(button)" class="button" ng-class="button.type" ng-repeat="button in buttons">{{button.text}}</button>\
|
||||||
</div>\
|
</div>\
|
||||||
@ -104,7 +107,10 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
|
|
||||||
compile: function(element, attr, transclude) {
|
compile: function(element, attr, transclude) {
|
||||||
return function($scope, $element, $attr) {
|
return function($scope, $element, $attr) {
|
||||||
var lv = new ionic.views.List({el: $element[0]});
|
var lv = new ionic.views.ListView({
|
||||||
|
el: $element[0],
|
||||||
|
listEl: $element[0].children[0]
|
||||||
|
});
|
||||||
|
|
||||||
if(attr.animation) {
|
if(attr.animation) {
|
||||||
$element.addClass(attr.animation);
|
$element.addClass(attr.animation);
|
||||||
|
|||||||
21
js/ext/angular/src/directive/ionicScroll.js
vendored
Normal file
21
js/ext/angular/src/directive/ionicScroll.js
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description
|
||||||
|
* The scroll directive lets you enable a content area for
|
||||||
|
* our custom momentum scrolling area. The benefit to a custom
|
||||||
|
* scroll area is configurability, and avoidance of the
|
||||||
|
* buggy -webkit-overflow-scrolling: touch.
|
||||||
|
*/
|
||||||
|
|
||||||
|
angular.module('ionic.ui.scroll', [])
|
||||||
|
|
||||||
|
.directive('scroll', function() {
|
||||||
|
return {
|
||||||
|
restrict: 'ECA',
|
||||||
|
replace: true,
|
||||||
|
transclude: true,
|
||||||
|
template: '<div class="scroll-content" ng-transclude></div>'
|
||||||
|
};
|
||||||
|
});
|
||||||
@ -63,7 +63,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<content ng-controller="TestCtrl" class="reveal-animation">
|
<div ng-controller="TestCtrl" class="reveal-animation scroll-content">
|
||||||
<list is-editing="isEditingItems" on-refresh-holding="almostRefreshing()" on-refresh-opening="almostRefreshProjects(ratio)" on-refresh="refreshProjects()" animation="my-repeat-animation" delete-icon="icon ion-minus-circled" reorder-icon="icon ion-navicon">
|
<list is-editing="isEditingItems" on-refresh-holding="almostRefreshing()" on-refresh-opening="almostRefreshProjects(ratio)" on-refresh="refreshProjects()" animation="my-repeat-animation" delete-icon="icon ion-minus-circled" reorder-icon="icon ion-navicon">
|
||||||
<list-refresher>
|
<list-refresher>
|
||||||
</list-refresher>
|
</list-refresher>
|
||||||
@ -79,7 +79,7 @@
|
|||||||
</list-item>
|
</list-item>
|
||||||
</list>
|
</list>
|
||||||
<button ng-click="edit()" class="button button-success">Edit</button>
|
<button ng-click="edit()" class="button button-success">Edit</button>
|
||||||
</content>
|
</div>
|
||||||
|
|
||||||
<script src="../../../../dist/js/ionic.js"></script>
|
<script src="../../../../dist/js/ionic.js"></script>
|
||||||
<script src="../../../../dist/js/ionic-angular.js"></script>
|
<script src="../../../../dist/js/ionic-angular.js"></script>
|
||||||
@ -132,9 +132,10 @@
|
|||||||
console.log("REFRESHING");
|
console.log("REFRESHING");
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.items = [
|
$scope.items = [];
|
||||||
{
|
for(var i = 0; i < 20; i++) {
|
||||||
text: 'Item 1',
|
$scope.items.push({
|
||||||
|
text: 'Item ' + i,
|
||||||
canDelete: true,
|
canDelete: true,
|
||||||
canSwipe: true,
|
canSwipe: true,
|
||||||
canReorder: true,
|
canReorder: true,
|
||||||
@ -146,47 +147,9 @@
|
|||||||
type: 'button-danger',
|
type: 'button-danger',
|
||||||
buttonClicked: removeItem,
|
buttonClicked: removeItem,
|
||||||
}]
|
}]
|
||||||
},
|
});
|
||||||
{
|
}
|
||||||
text: 'Item 2',
|
|
||||||
canDelete: true,
|
|
||||||
canSwipe: true,
|
|
||||||
canReorder: true,
|
|
||||||
icon: 'icon-chevron-right',
|
|
||||||
deleteItem: removeItem,
|
|
||||||
buttons: [{
|
|
||||||
text: 'Kill',
|
|
||||||
type: 'button-danger',
|
|
||||||
buttonClicked: removeItem,
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: 'Item 3',
|
|
||||||
canDelete: true,
|
|
||||||
canSwipe: true,
|
|
||||||
canReorder: true,
|
|
||||||
icon: 'icon-chevron-right',
|
|
||||||
deleteItem: removeItem,
|
|
||||||
buttons: [{
|
|
||||||
text: 'Kill',
|
|
||||||
type: 'button-danger',
|
|
||||||
buttonClicked: removeItem,
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: 'Item 4',
|
|
||||||
canDelete: true,
|
|
||||||
canSwipe: true,
|
|
||||||
canReorder: true,
|
|
||||||
icon: 'icon-chevron-right',
|
|
||||||
deleteItem: removeItem,
|
|
||||||
buttons: [{
|
|
||||||
text: 'Kill',
|
|
||||||
type: 'button-danger',
|
|
||||||
buttonClicked: removeItem,
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
$scope.edit = function() {
|
$scope.edit = function() {
|
||||||
$scope.isEditingItems = !$scope.isEditingItems;
|
$scope.isEditingItems = !$scope.isEditingItems;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -376,13 +376,6 @@
|
|||||||
// Start the drag states
|
// Start the drag states
|
||||||
this._initDrag();
|
this._initDrag();
|
||||||
|
|
||||||
// Listen for drag and release events
|
|
||||||
window.ionic.onGesture('drag', function(e) {
|
|
||||||
_this._handleDrag(e);
|
|
||||||
}, this.el);
|
|
||||||
window.ionic.onGesture('release', function(e) {
|
|
||||||
_this._handleEndDrag(e);
|
|
||||||
}, this.el);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ionic.views.List.prototype = {
|
ionic.views.List.prototype = {
|
||||||
@ -417,6 +410,8 @@
|
|||||||
|
|
||||||
this._isDragging = false;
|
this._isDragging = false;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
// Check if this is a reorder drag
|
// Check if this is a reorder drag
|
||||||
if(ionic.DomUtil.getParentOrSelfWithClass(e.target, 'list-item-drag') && (e.gesture.direction == 'up' || e.gesture.direction == 'down')) {
|
if(ionic.DomUtil.getParentOrSelfWithClass(e.target, 'list-item-drag') && (e.gesture.direction == 'up' || e.gesture.direction == 'down')) {
|
||||||
var item = this._getItem(e.target);
|
var item = this._getItem(e.target);
|
||||||
@ -454,6 +449,7 @@
|
|||||||
|
|
||||||
_handleEndDrag: function(e) {
|
_handleEndDrag: function(e) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
return false;
|
||||||
|
|
||||||
if(!this._dragOp) {
|
if(!this._dragOp) {
|
||||||
this._initDrag();
|
this._initDrag();
|
||||||
@ -470,6 +466,7 @@
|
|||||||
*/
|
*/
|
||||||
_handleDrag: function(e) {
|
_handleDrag: function(e) {
|
||||||
var _this = this, content, buttons;
|
var _this = this, content, buttons;
|
||||||
|
return false;
|
||||||
|
|
||||||
if(!this._dragOp) {
|
if(!this._dragOp) {
|
||||||
this._startDrag(e);
|
this._startDrag(e);
|
||||||
|
|||||||
@ -483,6 +483,14 @@ button.item-button-right:after {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
.icon, i {
|
||||||
|
@include display-flex();
|
||||||
|
@include align-items(center);
|
||||||
|
font-size: 24px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -67,6 +67,14 @@ body, .ionic-body {
|
|||||||
-webkit-overflow-scrolling: touch;
|
-webkit-overflow-scrolling: touch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scroll-content {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
// Pad top/bottom of content so it doesn't hide behind .bar-title and .bar-tab.
|
// Pad top/bottom of content so it doesn't hide behind .bar-title and .bar-tab.
|
||||||
// Note: For these to work, content must come after both bars in the markup
|
// Note: For these to work, content must come after both bars in the markup
|
||||||
.has-header {
|
.has-header {
|
||||||
|
|||||||
@ -403,6 +403,7 @@ $card-border-radius: 2px !default;
|
|||||||
|
|
||||||
$item-border-width: 1px !default;
|
$item-border-width: 1px !default;
|
||||||
$item-border-color: #666;
|
$item-border-color: #666;
|
||||||
|
$item-border-style: solid;
|
||||||
$item-box-shadow: inset 0 0 $item-border-width $item-border-color;
|
$item-box-shadow: inset 0 0 $item-border-width $item-border-color;
|
||||||
$item-padding: 15px !default;
|
$item-padding: 15px !default;
|
||||||
|
|
||||||
|
|||||||
2504
test/biglists.html
2504
test/biglists.html
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user