mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
Only show refresher on drag
This commit is contained in:
1
dist/css/ionic.css
vendored
1
dist/css/ionic.css
vendored
@ -2289,6 +2289,7 @@ body, .ionic-body {
|
|||||||
text-size-adjust: none; }
|
text-size-adjust: none; }
|
||||||
|
|
||||||
.scroll-refresher {
|
.scroll-refresher {
|
||||||
|
display: none;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
margin-top: -100px; }
|
margin-top: -100px; }
|
||||||
|
|||||||
10
dist/js/ionic.js
vendored
10
dist/js/ionic.js
vendored
@ -2395,6 +2395,9 @@ window.ionic = {
|
|||||||
if(this.hasPullToRefresh) {
|
if(this.hasPullToRefresh) {
|
||||||
this._refresher = document.querySelector('.scroll-refresher');
|
this._refresher = document.querySelector('.scroll-refresher');
|
||||||
this._refresherHeight = parseFloat(this._refresher.firstElementChild.offsetHeight) || 100;
|
this._refresherHeight = parseFloat(this._refresher.firstElementChild.offsetHeight) || 100;
|
||||||
|
// We always start the refresher hidden
|
||||||
|
this._isRefresherHidden = true;
|
||||||
|
|
||||||
if(this._refresher) {
|
if(this._refresher) {
|
||||||
this._refresher.classList.remove('scroll-refreshing');
|
this._refresher.classList.remove('scroll-refreshing');
|
||||||
}
|
}
|
||||||
@ -2494,10 +2497,15 @@ window.ionic = {
|
|||||||
if(_this._refresher && newY > 0) {
|
if(_this._refresher && newY > 0) {
|
||||||
// We are pulling to refresh, so update the refresher
|
// We are pulling to refresh, so update the refresher
|
||||||
//_this._refresher.style[ionic.CSS.TRANSFORM] = 'translate3d(0, ' + newY + 'px, 0)';
|
//_this._refresher.style[ionic.CSS.TRANSFORM] = 'translate3d(0, ' + newY + 'px, 0)';
|
||||||
|
if(_this._isRefresherHidden) {
|
||||||
|
// Show it only in a drag and if we haven't showed it yet
|
||||||
|
_this._refresher.style.display = 'block';
|
||||||
|
_this._isRefresherHidden = false;
|
||||||
|
}
|
||||||
|
|
||||||
if(newY > _this._refresherHeight && !_this._isHoldingRefresh) {
|
if(newY > _this._refresherHeight && !_this._isHoldingRefresh) {
|
||||||
_this._isHoldingRefresh = true;
|
_this._isHoldingRefresh = true;
|
||||||
// Trigger refresh holding event here
|
// Trigger refresh holding event here
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Trigger refresh open amount
|
// Trigger refresh open amount
|
||||||
var ratio = Math.min(1, newY / _this._refresherHeight);
|
var ratio = Math.min(1, newY / _this._refresherHeight);
|
||||||
|
|||||||
@ -486,6 +486,9 @@
|
|||||||
if(this.hasPullToRefresh) {
|
if(this.hasPullToRefresh) {
|
||||||
this._refresher = document.querySelector('.scroll-refresher');
|
this._refresher = document.querySelector('.scroll-refresher');
|
||||||
this._refresherHeight = parseFloat(this._refresher.firstElementChild.offsetHeight) || 100;
|
this._refresherHeight = parseFloat(this._refresher.firstElementChild.offsetHeight) || 100;
|
||||||
|
// We always start the refresher hidden
|
||||||
|
this._isRefresherHidden = true;
|
||||||
|
|
||||||
if(this._refresher) {
|
if(this._refresher) {
|
||||||
this._refresher.classList.remove('scroll-refreshing');
|
this._refresher.classList.remove('scroll-refreshing');
|
||||||
}
|
}
|
||||||
@ -585,10 +588,15 @@
|
|||||||
if(_this._refresher && newY > 0) {
|
if(_this._refresher && newY > 0) {
|
||||||
// We are pulling to refresh, so update the refresher
|
// We are pulling to refresh, so update the refresher
|
||||||
//_this._refresher.style[ionic.CSS.TRANSFORM] = 'translate3d(0, ' + newY + 'px, 0)';
|
//_this._refresher.style[ionic.CSS.TRANSFORM] = 'translate3d(0, ' + newY + 'px, 0)';
|
||||||
|
if(_this._isRefresherHidden) {
|
||||||
|
// Show it only in a drag and if we haven't showed it yet
|
||||||
|
_this._refresher.style.display = 'block';
|
||||||
|
_this._isRefresherHidden = false;
|
||||||
|
}
|
||||||
|
|
||||||
if(newY > _this._refresherHeight && !_this._isHoldingRefresh) {
|
if(newY > _this._refresherHeight && !_this._isHoldingRefresh) {
|
||||||
_this._isHoldingRefresh = true;
|
_this._isHoldingRefresh = true;
|
||||||
// Trigger refresh holding event here
|
// Trigger refresh holding event here
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Trigger refresh open amount
|
// Trigger refresh open amount
|
||||||
var ratio = Math.min(1, newY / _this._refresherHeight);
|
var ratio = Math.min(1, newY / _this._refresherHeight);
|
||||||
|
|||||||
@ -109,6 +109,7 @@ body, .ionic-body {
|
|||||||
|
|
||||||
// Scroll refresher (for pull to refresh)
|
// Scroll refresher (for pull to refresh)
|
||||||
.scroll-refresher {
|
.scroll-refresher {
|
||||||
|
display: none;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
margin-top: -100px;
|
margin-top: -100px;
|
||||||
|
|||||||
Reference in New Issue
Block a user