mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
Working on animator
This commit is contained in:
4
dist/ionic.css
vendored
4
dist/ionic.css
vendored
@ -1436,6 +1436,7 @@ address {
|
|||||||
.modal {
|
.modal {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
|
visibility: hidden;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
@ -1445,6 +1446,7 @@ address {
|
|||||||
-webkit-transform: translate3d(0, 100%, 0);
|
-webkit-transform: translate3d(0, 100%, 0);
|
||||||
transform: translate3d(0, 100%, 0); }
|
transform: translate3d(0, 100%, 0); }
|
||||||
.modal.active {
|
.modal.active {
|
||||||
|
visibility: visible;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
-webkit-transform: translate3d(0, 0, 0);
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
@ -2146,7 +2148,7 @@ a.button {
|
|||||||
transition: transform 0.25s, opacity 1ms 0.25s;
|
transition: transform 0.25s, opacity 1ms 0.25s;
|
||||||
-webkit-transition-timing-function: cubic-bezier(0.1, 0.5, 0.1, 1); }
|
-webkit-transition-timing-function: cubic-bezier(0.1, 0.5, 0.1, 1); }
|
||||||
|
|
||||||
.slide-in-up.active {
|
.slide-in-up.enter {
|
||||||
-webkit-transition: -webkit-transform 0.25s;
|
-webkit-transition: -webkit-transform 0.25s;
|
||||||
transition: transform 0.25s;
|
transition: transform 0.25s;
|
||||||
-webkit-transition-timing-function: cubic-bezier(0.1, 0.5, 0.1, 1); }
|
-webkit-transition-timing-function: cubic-bezier(0.1, 0.5, 0.1, 1); }
|
||||||
|
|||||||
21
dist/ionic.js
vendored
21
dist/ionic.js
vendored
@ -32,9 +32,7 @@ if ( document.readyState === "complete" ) {
|
|||||||
detect: function() {
|
detect: function() {
|
||||||
var platforms = [];
|
var platforms = [];
|
||||||
|
|
||||||
console.log('Checking platforms');
|
|
||||||
var platform = this._checkPlatforms(platforms);
|
var platform = this._checkPlatforms(platforms);
|
||||||
console.log('Got platforms', platforms);
|
|
||||||
|
|
||||||
for(var i = 0; i < platforms.length; i++) {
|
for(var i = 0; i < platforms.length; i++) {
|
||||||
document.body.classList.add('platform-' + platforms[i]);
|
document.body.classList.add('platform-' + platforms[i]);
|
||||||
@ -53,7 +51,9 @@ if ( document.readyState === "complete" ) {
|
|||||||
// Check if we are running in Cordova, which will have
|
// Check if we are running in Cordova, which will have
|
||||||
// window.device available.
|
// window.device available.
|
||||||
isCordova: function() {
|
isCordova: function() {
|
||||||
return 'device' in window;
|
return (window.cordova || window.PhoneGap || window.phonegap);
|
||||||
|
//&& /^file:\/{3}[^\/]/i.test(window.location.href)
|
||||||
|
//&& /ios|iphone|ipod|ipad|android/i.test(navigator.userAgent);
|
||||||
},
|
},
|
||||||
isIOS7: function() {
|
isIOS7: function() {
|
||||||
if(!window.device) {
|
if(!window.device) {
|
||||||
@ -1624,6 +1624,21 @@ if ( document.readyState === "complete" ) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
})(ionic = window.ionic || {});
|
})(ionic = window.ionic || {});
|
||||||
|
;(function(ionic) {
|
||||||
|
ionic.Animator = {
|
||||||
|
animate: function(element, fn) {
|
||||||
|
var endFunc = function() {
|
||||||
|
console.log('Animation finished for element', element);
|
||||||
|
element.removeEventListener('webkitTransitionEnd', endFunc);
|
||||||
|
element.removeEventListener('transitionEnd', endFunc);
|
||||||
|
};
|
||||||
|
element.addEventListener('webkitTransitionEnd', endFunc);
|
||||||
|
element.addEventListener('transitionEnd', endFunc);
|
||||||
|
|
||||||
|
element.classList.add('enter');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})(ionic = window.ionic || {});
|
||||||
;(function(ionic) {
|
;(function(ionic) {
|
||||||
ionic.ViewController = function(options) {
|
ionic.ViewController = function(options) {
|
||||||
this.init();
|
this.init();
|
||||||
|
|||||||
15
js/animate.js
Normal file
15
js/animate.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
(function(ionic) {
|
||||||
|
ionic.Animator = {
|
||||||
|
animate: function(element, fn) {
|
||||||
|
var endFunc = function() {
|
||||||
|
console.log('Animation finished for element', element);
|
||||||
|
element.removeEventListener('webkitTransitionEnd', endFunc);
|
||||||
|
element.removeEventListener('transitionEnd', endFunc);
|
||||||
|
};
|
||||||
|
element.addEventListener('webkitTransitionEnd', endFunc);
|
||||||
|
element.addEventListener('transitionEnd', endFunc);
|
||||||
|
|
||||||
|
element.classList.add('enter');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})(ionic = window.ionic || {});
|
||||||
@ -4,9 +4,7 @@
|
|||||||
detect: function() {
|
detect: function() {
|
||||||
var platforms = [];
|
var platforms = [];
|
||||||
|
|
||||||
console.log('Checking platforms');
|
|
||||||
var platform = this._checkPlatforms(platforms);
|
var platform = this._checkPlatforms(platforms);
|
||||||
console.log('Got platforms', platforms);
|
|
||||||
|
|
||||||
for(var i = 0; i < platforms.length; i++) {
|
for(var i = 0; i < platforms.length; i++) {
|
||||||
document.body.classList.add('platform-' + platforms[i]);
|
document.body.classList.add('platform-' + platforms[i]);
|
||||||
|
|||||||
@ -20,7 +20,7 @@ $bezier-function: cubic-bezier(.1, .5, .1, 1);
|
|||||||
-webkit-transition-timing-function: $bezier-function;
|
-webkit-transition-timing-function: $bezier-function;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slide-in-up.active {
|
.slide-in-up.enter {
|
||||||
-webkit-transition: -webkit-transform .25s;
|
-webkit-transition: -webkit-transform .25s;
|
||||||
transition: transform .25s;
|
transition: transform .25s;
|
||||||
-webkit-transition-timing-function: $bezier-function;
|
-webkit-transition-timing-function: $bezier-function;
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
|
|
||||||
z-index: $zindex-modal;
|
z-index: $zindex-modal;
|
||||||
|
visibility: hidden;
|
||||||
|
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
||||||
@ -16,7 +17,7 @@
|
|||||||
|
|
||||||
background-color: $modal-bg-color;
|
background-color: $modal-bg-color;
|
||||||
|
|
||||||
// Start it hidden
|
// Start hidden
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
||||||
// Start it down low
|
// Start it down low
|
||||||
@ -25,6 +26,8 @@
|
|||||||
|
|
||||||
// Active modal
|
// Active modal
|
||||||
&.active {
|
&.active {
|
||||||
|
visibility: visible;
|
||||||
|
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
// Put it up
|
// Put it up
|
||||||
|
|||||||
@ -41,14 +41,17 @@
|
|||||||
|
|
||||||
ionic.on('tap', function(e) {
|
ionic.on('tap', function(e) {
|
||||||
var modal = document.getElementById('modal');
|
var modal = document.getElementById('modal');
|
||||||
modal.classList.add('active');
|
//modal.classList.add('active');
|
||||||
|
ionic.Animator.animate(modal, function() {
|
||||||
|
console.log('Animation finished');
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}, open);
|
}, open);
|
||||||
|
|
||||||
var closer = document.getElementById('modal-closer');
|
var closer = document.getElementById('modal-closer');
|
||||||
ionic.on('tap', function(e) {
|
ionic.on('tap', function(e) {
|
||||||
var modal = document.getElementById('modal');
|
var modal = document.getElementById('modal');
|
||||||
modal.classList.remove('active');
|
//modal.classList.remove('active');
|
||||||
return false;
|
return false;
|
||||||
}, closer);
|
}, closer);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user