mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
Fixed #99 with requestAnimationFrame polyfill
This commit is contained in:
10
dist/css/ionic.css
vendored
10
dist/css/ionic.css
vendored
@ -2019,7 +2019,7 @@ sub {
|
|||||||
fieldset {
|
fieldset {
|
||||||
margin: 0 2px;
|
margin: 0 2px;
|
||||||
padding: 0.35em 0.625em 0.75em;
|
padding: 0.35em 0.625em 0.75em;
|
||||||
border: 1px solid #c0c0c0; }
|
border: 1px solid silver; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1. Correct `color` not being inherited in IE 8/9.
|
* 1. Correct `color` not being inherited in IE 8/9.
|
||||||
@ -3894,7 +3894,7 @@ input[type="file"] {
|
|||||||
line-height: 34px; }
|
line-height: 34px; }
|
||||||
|
|
||||||
select {
|
select {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #cccccc;
|
||||||
background-color: white; }
|
background-color: white; }
|
||||||
|
|
||||||
select[multiple],
|
select[multiple],
|
||||||
@ -3953,7 +3953,7 @@ input[type="checkbox"][readonly] {
|
|||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: white;
|
background: white;
|
||||||
content: ' ';
|
content: ' ';
|
||||||
transition: background-color .1s ease-in-out; }
|
transition: background-color 0.1s ease-in-out; }
|
||||||
|
|
||||||
/* the checkmark within the box */
|
/* the checkmark within the box */
|
||||||
.checkbox input:after {
|
.checkbox input:after {
|
||||||
@ -3968,7 +3968,7 @@ input[type="checkbox"][readonly] {
|
|||||||
border-right: 0;
|
border-right: 0;
|
||||||
content: ' ';
|
content: ' ';
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity .05s ease-in-out;
|
transition: opacity 0.05s ease-in-out;
|
||||||
-webkit-transform: rotate(-45deg);
|
-webkit-transform: rotate(-45deg);
|
||||||
transform: rotate(-45deg); }
|
transform: rotate(-45deg); }
|
||||||
|
|
||||||
@ -4397,7 +4397,7 @@ input[type="range"] {
|
|||||||
.button-icon:active, .button-icon.active {
|
.button-icon:active, .button-icon.active {
|
||||||
background: none;
|
background: none;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
text-shadow: 0px 0px 10px #fff; }
|
text-shadow: 0px 0px 10px white; }
|
||||||
|
|
||||||
.padding > .button.block:first-child {
|
.padding > .button.block:first-child {
|
||||||
margin-top: 0; }
|
margin-top: 0; }
|
||||||
|
|||||||
5
dist/css/themes/ionic-ios7.css
vendored
5
dist/css/themes/ionic-ios7.css
vendored
@ -1,3 +1,4 @@
|
|||||||
|
@charset "UTF-8";
|
||||||
/**
|
/**
|
||||||
* Mixins
|
* Mixins
|
||||||
* --------------------------------------------------
|
* --------------------------------------------------
|
||||||
@ -123,7 +124,7 @@
|
|||||||
right: 20px;
|
right: 20px;
|
||||||
transition: 0.2s ease;
|
transition: 0.2s ease;
|
||||||
transition-property: left, right;
|
transition-property: left, right;
|
||||||
transition-delay: 0s, .05s; }
|
transition-delay: 0s, 0.05s; }
|
||||||
|
|
||||||
.toggle :checked + .track {
|
.toggle :checked + .track {
|
||||||
/* When the toggle is "on" */
|
/* When the toggle is "on" */
|
||||||
@ -138,4 +139,4 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
left: 20px;
|
left: 20px;
|
||||||
-webkit-transform: none;
|
-webkit-transform: none;
|
||||||
transition-delay: .05s, 0s; }
|
transition-delay: 0.05s, 0s; }
|
||||||
|
|||||||
49
dist/js/ionic.js
vendored
49
dist/js/ionic.js
vendored
@ -1742,6 +1742,23 @@ window.ionic = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ionic.Platform.detect();
|
ionic.Platform.detect();
|
||||||
|
})(window.ionic);
|
||||||
|
;
|
||||||
|
(function(ionic) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// From the man himself, Mr. Paul Irish.
|
||||||
|
// The requestAnimationFrame polyfill
|
||||||
|
window.rAF = (function(){
|
||||||
|
return window.requestAnimationFrame ||
|
||||||
|
window.webkitRequestAnimationFrame ||
|
||||||
|
window.mozRequestAnimationFrame ||
|
||||||
|
function( callback ){
|
||||||
|
window.setTimeout(callback, 1000 / 60);
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
})(window.ionic);
|
})(window.ionic);
|
||||||
;
|
;
|
||||||
(function(window, document, ionic) {
|
(function(window, document, ionic) {
|
||||||
@ -2307,7 +2324,7 @@ window.ionic = {
|
|||||||
|
|
||||||
this.el.style.webkitTransitionDuration = '0';
|
this.el.style.webkitTransitionDuration = '0';
|
||||||
|
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
if(_this.wrapScrollPosition(_this.bounceTime)) {
|
if(_this.wrapScrollPosition(_this.bounceTime)) {
|
||||||
_this._didEndScroll = true;
|
_this._didEndScroll = true;
|
||||||
}
|
}
|
||||||
@ -2422,7 +2439,7 @@ window.ionic = {
|
|||||||
var drag = _this._drag;
|
var drag = _this._drag;
|
||||||
|
|
||||||
// Request an animation frame to batch DOM reads/writes
|
// Request an animation frame to batch DOM reads/writes
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
// We are dragging, grab the current content height
|
// We are dragging, grab the current content height
|
||||||
|
|
||||||
var totalWidth = _this.el.scrollWidth;
|
var totalWidth = _this.el.scrollWidth;
|
||||||
@ -2527,7 +2544,7 @@ window.ionic = {
|
|||||||
// animate to that position
|
// animate to that position
|
||||||
_animateToStop: function(e) {
|
_animateToStop: function(e) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
|
|
||||||
var drag = _this._drag;
|
var drag = _this._drag;
|
||||||
|
|
||||||
@ -2774,7 +2791,7 @@ window.ionic = {
|
|||||||
SlideDrag.prototype.drag = function(e) {
|
SlideDrag.prototype.drag = function(e) {
|
||||||
var _this = this, buttonsWidth;
|
var _this = this, buttonsWidth;
|
||||||
|
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
// We really aren't dragging
|
// We really aren't dragging
|
||||||
if(!_this._currentDrag) {
|
if(!_this._currentDrag) {
|
||||||
return;
|
return;
|
||||||
@ -2841,7 +2858,7 @@ window.ionic = {
|
|||||||
e.target.removeEventListener('webkitTransitionEnd', onRestingAnimationEnd);
|
e.target.removeEventListener('webkitTransitionEnd', onRestingAnimationEnd);
|
||||||
};
|
};
|
||||||
|
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
var currentX = parseFloat(_this._currentDrag.content.style.webkitTransform.replace('translate3d(', '').split(',')[0]) || 0;
|
var currentX = parseFloat(_this._currentDrag.content.style.webkitTransform.replace('translate3d(', '').split(',')[0]) || 0;
|
||||||
if(currentX !== restingPoint) {
|
if(currentX !== restingPoint) {
|
||||||
_this._currentDrag.content.classList.add(ITEM_SLIDING_CLASS);
|
_this._currentDrag.content.classList.add(ITEM_SLIDING_CLASS);
|
||||||
@ -2890,7 +2907,7 @@ window.ionic = {
|
|||||||
ReorderDrag.prototype.drag = function(e) {
|
ReorderDrag.prototype.drag = function(e) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
// We really aren't dragging
|
// We really aren't dragging
|
||||||
if(!_this._currentDrag) {
|
if(!_this._currentDrag) {
|
||||||
return;
|
return;
|
||||||
@ -3165,18 +3182,16 @@ window.ionic = {
|
|||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
if(this._loadingBox) {
|
if(this._loadingBox) {
|
||||||
//window.requestAnimationFrame(function() {
|
var lb = _this._loadingBox;
|
||||||
var lb = _this._loadingBox;
|
|
||||||
|
|
||||||
var width = Math.min(_this.maxWidth, Math.max(window.outerWidth - 40, lb.offsetWidth));
|
var width = Math.min(_this.maxWidth, Math.max(window.outerWidth - 40, lb.offsetWidth));
|
||||||
|
|
||||||
lb.style.width = width;
|
lb.style.width = width;
|
||||||
|
|
||||||
lb.style.marginLeft = (-lb.offsetWidth) / 2 + 'px';
|
lb.style.marginLeft = (-lb.offsetWidth) / 2 + 'px';
|
||||||
lb.style.marginTop = (-lb.offsetHeight) / 2 + 'px';
|
lb.style.marginTop = (-lb.offsetHeight) / 2 + 'px';
|
||||||
|
|
||||||
_this.el.classList.add('active');
|
_this.el.classList.add('active');
|
||||||
//});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hide: function() {
|
hide: function() {
|
||||||
@ -3285,7 +3300,7 @@ window.ionic = {
|
|||||||
alert: function(message) {
|
alert: function(message) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
_this.setTitle(message);
|
_this.setTitle(message);
|
||||||
_this.el.classList.add('active');
|
_this.el.classList.add('active');
|
||||||
});
|
});
|
||||||
@ -3520,7 +3535,7 @@ window.ionic = {
|
|||||||
var _this = this,
|
var _this = this,
|
||||||
finalOffsetX, content, ratio, slideWidth, totalWidth, offsetX;
|
finalOffsetX, content, ratio, slideWidth, totalWidth, offsetX;
|
||||||
|
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
|
|
||||||
// We didn't have a drag, so just init and leave
|
// We didn't have a drag, so just init and leave
|
||||||
if(!_this._drag) {
|
if(!_this._drag) {
|
||||||
@ -3613,7 +3628,7 @@ window.ionic = {
|
|||||||
_handleDrag: function(e) {
|
_handleDrag: function(e) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
var content;
|
var content;
|
||||||
|
|
||||||
// We really aren't dragging
|
// We really aren't dragging
|
||||||
|
|||||||
16
js/utils/poly.js
Normal file
16
js/utils/poly.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
(function(ionic) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// From the man himself, Mr. Paul Irish.
|
||||||
|
// The requestAnimationFrame polyfill
|
||||||
|
window.rAF = (function(){
|
||||||
|
return window.requestAnimationFrame ||
|
||||||
|
window.webkitRequestAnimationFrame ||
|
||||||
|
window.mozRequestAnimationFrame ||
|
||||||
|
function( callback ){
|
||||||
|
window.setTimeout(callback, 1000 / 60);
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
})(window.ionic);
|
||||||
@ -65,7 +65,7 @@
|
|||||||
SlideDrag.prototype.drag = function(e) {
|
SlideDrag.prototype.drag = function(e) {
|
||||||
var _this = this, buttonsWidth;
|
var _this = this, buttonsWidth;
|
||||||
|
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
// We really aren't dragging
|
// We really aren't dragging
|
||||||
if(!_this._currentDrag) {
|
if(!_this._currentDrag) {
|
||||||
return;
|
return;
|
||||||
@ -132,7 +132,7 @@
|
|||||||
e.target.removeEventListener('webkitTransitionEnd', onRestingAnimationEnd);
|
e.target.removeEventListener('webkitTransitionEnd', onRestingAnimationEnd);
|
||||||
};
|
};
|
||||||
|
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
var currentX = parseFloat(_this._currentDrag.content.style.webkitTransform.replace('translate3d(', '').split(',')[0]) || 0;
|
var currentX = parseFloat(_this._currentDrag.content.style.webkitTransform.replace('translate3d(', '').split(',')[0]) || 0;
|
||||||
if(currentX !== restingPoint) {
|
if(currentX !== restingPoint) {
|
||||||
_this._currentDrag.content.classList.add(ITEM_SLIDING_CLASS);
|
_this._currentDrag.content.classList.add(ITEM_SLIDING_CLASS);
|
||||||
@ -181,7 +181,7 @@
|
|||||||
ReorderDrag.prototype.drag = function(e) {
|
ReorderDrag.prototype.drag = function(e) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
// We really aren't dragging
|
// We really aren't dragging
|
||||||
if(!_this._currentDrag) {
|
if(!_this._currentDrag) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -21,18 +21,16 @@
|
|||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
if(this._loadingBox) {
|
if(this._loadingBox) {
|
||||||
//window.requestAnimationFrame(function() {
|
var lb = _this._loadingBox;
|
||||||
var lb = _this._loadingBox;
|
|
||||||
|
|
||||||
var width = Math.min(_this.maxWidth, Math.max(window.outerWidth - 40, lb.offsetWidth));
|
var width = Math.min(_this.maxWidth, Math.max(window.outerWidth - 40, lb.offsetWidth));
|
||||||
|
|
||||||
lb.style.width = width;
|
lb.style.width = width;
|
||||||
|
|
||||||
lb.style.marginLeft = (-lb.offsetWidth) / 2 + 'px';
|
lb.style.marginLeft = (-lb.offsetWidth) / 2 + 'px';
|
||||||
lb.style.marginTop = (-lb.offsetHeight) / 2 + 'px';
|
lb.style.marginTop = (-lb.offsetHeight) / 2 + 'px';
|
||||||
|
|
||||||
_this.el.classList.add('active');
|
_this.el.classList.add('active');
|
||||||
//});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hide: function() {
|
hide: function() {
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
alert: function(message) {
|
alert: function(message) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
_this.setTitle(message);
|
_this.setTitle(message);
|
||||||
_this.el.classList.add('active');
|
_this.el.classList.add('active');
|
||||||
});
|
});
|
||||||
|
|||||||
@ -430,7 +430,7 @@
|
|||||||
|
|
||||||
this.el.style.webkitTransitionDuration = '0';
|
this.el.style.webkitTransitionDuration = '0';
|
||||||
|
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
if(_this.wrapScrollPosition(_this.bounceTime)) {
|
if(_this.wrapScrollPosition(_this.bounceTime)) {
|
||||||
_this._didEndScroll = true;
|
_this._didEndScroll = true;
|
||||||
}
|
}
|
||||||
@ -545,7 +545,7 @@
|
|||||||
var drag = _this._drag;
|
var drag = _this._drag;
|
||||||
|
|
||||||
// Request an animation frame to batch DOM reads/writes
|
// Request an animation frame to batch DOM reads/writes
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
// We are dragging, grab the current content height
|
// We are dragging, grab the current content height
|
||||||
|
|
||||||
var totalWidth = _this.el.scrollWidth;
|
var totalWidth = _this.el.scrollWidth;
|
||||||
@ -650,7 +650,7 @@
|
|||||||
// animate to that position
|
// animate to that position
|
||||||
_animateToStop: function(e) {
|
_animateToStop: function(e) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
|
|
||||||
var drag = _this._drag;
|
var drag = _this._drag;
|
||||||
|
|
||||||
|
|||||||
@ -192,7 +192,7 @@
|
|||||||
var _this = this,
|
var _this = this,
|
||||||
finalOffsetX, content, ratio, slideWidth, totalWidth, offsetX;
|
finalOffsetX, content, ratio, slideWidth, totalWidth, offsetX;
|
||||||
|
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
|
|
||||||
// We didn't have a drag, so just init and leave
|
// We didn't have a drag, so just init and leave
|
||||||
if(!_this._drag) {
|
if(!_this._drag) {
|
||||||
@ -285,7 +285,7 @@
|
|||||||
_handleDrag: function(e) {
|
_handleDrag: function(e) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
window.requestAnimationFrame(function() {
|
window.rAF(function() {
|
||||||
var content;
|
var content;
|
||||||
|
|
||||||
// We really aren't dragging
|
// We really aren't dragging
|
||||||
|
|||||||
Reference in New Issue
Block a user