mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
Working on custom refresher
This commit is contained in:
16
dist/css/ionic.css
vendored
16
dist/css/ionic.css
vendored
@ -2327,6 +2327,22 @@ body, .ionic-body {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
position: relative; }
|
position: relative; }
|
||||||
|
|
||||||
|
.ionic-refresher-content {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
position: relative; }
|
||||||
|
|
||||||
|
.ionic-refresher {
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #4a87ee;
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -5px;
|
||||||
|
bottom: 15px; }
|
||||||
|
|
||||||
.scroll-refreshing {
|
.scroll-refreshing {
|
||||||
-webkit-transition: height 0.1s ease-in-out; }
|
-webkit-transition: height 0.1s ease-in-out; }
|
||||||
|
|
||||||
|
|||||||
24
dist/js/ionic-angular.js
vendored
24
dist/js/ionic-angular.js
vendored
@ -548,11 +548,29 @@ angular.module('ionic.ui.content', [])
|
|||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
replace: true,
|
replace: true,
|
||||||
transclude: true,
|
require: ['^?content', '^?list'],
|
||||||
template: '<div class="scroll-refresher"><div class="scroll-refresher-content" ng-transclude></div></div>'
|
template: '<div class="scroll-refresher"><div class="ionic-refresher-content"><div class="ionic-refresher"></div></div></div>',
|
||||||
|
scope: true,
|
||||||
|
link: function($scope, $element, $attr, scrollCtrl) {
|
||||||
|
$scope.$on('onRefresh', function() {
|
||||||
|
});
|
||||||
|
$scope.$on('onRefreshOpening', function(amt) {
|
||||||
|
console.log('On refresh opening', amt);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
.directive('scroll-refresher', function() {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
replace: true,
|
||||||
|
transclude: true,
|
||||||
|
template: '<div class="scroll-refresher"><div class="scroll-refresher-content"></div></div>'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
;
|
;
|
||||||
(function() {
|
(function() {
|
||||||
@ -667,9 +685,11 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
hasPullToRefresh: ($scope.hasPullToRefresh !== 'false'),
|
hasPullToRefresh: ($scope.hasPullToRefresh !== 'false'),
|
||||||
onRefresh: function() {
|
onRefresh: function() {
|
||||||
$scope.onRefresh();
|
$scope.onRefresh();
|
||||||
|
$scope.$broadcast('onRefresh');
|
||||||
},
|
},
|
||||||
onRefreshOpening: function(amt) {
|
onRefreshOpening: function(amt) {
|
||||||
$scope.onRefreshOpening({amount: amt});
|
$scope.onRefreshOpening({amount: amt});
|
||||||
|
$scope.$broadcast('onRefreshOpening', amt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
22
js/ext/angular/src/directive/ionicContent.js
vendored
22
js/ext/angular/src/directive/ionicContent.js
vendored
@ -76,9 +76,27 @@ angular.module('ionic.ui.content', [])
|
|||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
replace: true,
|
replace: true,
|
||||||
transclude: true,
|
require: ['^?content', '^?list'],
|
||||||
template: '<div class="scroll-refresher"><div class="scroll-refresher-content" ng-transclude></div></div>'
|
template: '<div class="scroll-refresher"><div class="ionic-refresher-content"><div class="ionic-refresher"></div></div></div>',
|
||||||
|
scope: true,
|
||||||
|
link: function($scope, $element, $attr, scrollCtrl) {
|
||||||
|
$scope.$on('onRefresh', function() {
|
||||||
|
});
|
||||||
|
$scope.$on('onRefreshOpening', function(amt) {
|
||||||
|
console.log('On refresh opening', amt);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
.directive('scroll-refresher', function() {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
replace: true,
|
||||||
|
transclude: true,
|
||||||
|
template: '<div class="scroll-refresher"><div class="scroll-refresher-content"></div></div>'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
2
js/ext/angular/src/directive/ionicList.js
vendored
2
js/ext/angular/src/directive/ionicList.js
vendored
@ -110,9 +110,11 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
hasPullToRefresh: ($scope.hasPullToRefresh !== 'false'),
|
hasPullToRefresh: ($scope.hasPullToRefresh !== 'false'),
|
||||||
onRefresh: function() {
|
onRefresh: function() {
|
||||||
$scope.onRefresh();
|
$scope.onRefresh();
|
||||||
|
$scope.$broadcast('onRefresh');
|
||||||
},
|
},
|
||||||
onRefreshOpening: function(amt) {
|
onRefreshOpening: function(amt) {
|
||||||
$scope.onRefreshOpening({amount: amt});
|
$scope.onRefreshOpening({amount: amt});
|
||||||
|
$scope.$broadcast('onRefreshOpening', amt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -122,6 +122,23 @@ body, .ionic-body {
|
|||||||
//@include display-flex();
|
//@include display-flex();
|
||||||
//@include align-items(center);
|
//@include align-items(center);
|
||||||
}
|
}
|
||||||
|
.ionic-refresher-content {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.ionic-refresher {
|
||||||
|
// A custom refresher
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: $brand-primary;
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -5px;
|
||||||
|
bottom: 15px;
|
||||||
|
}
|
||||||
.scroll-refreshing {
|
.scroll-refreshing {
|
||||||
-webkit-transition: height 0.1s ease-in-out;
|
-webkit-transition: height 0.1s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user