mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
140 lines
4.2 KiB
HTML
140 lines
4.2 KiB
HTML
<html ng-app="navTest">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Content</title>
|
|
|
|
<!-- Sets initial viewport load and disables zooming -->
|
|
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
<link rel="stylesheet" href="../../../../dist/css/ionic.css">
|
|
|
|
<script src="../../../../dist/js/ionic.js"></script>
|
|
<script src="../../../../dist/js/angular/angular.js"></script>
|
|
<script src="../../../../dist/js/angular/angular-animate.js"></script>
|
|
<script src="../../../../dist/js/angular/angular-route.js"></script>
|
|
<script src="../../../../dist/js/angular/angular-touch.js"></script>
|
|
<script src="../../../../dist/js/angular/angular-sanitize.js"></script>
|
|
<script src="../../../../dist/js/ionic-angular.js"></script>
|
|
<style>
|
|
.reveal-animation {
|
|
/*
|
|
-webkit-transform: translate3d(0%, 0, 0);
|
|
transform: translate3d(0%, 0, 0);
|
|
|
|
-webkit-transition: -webkit-transform 1s ease-in-out;
|
|
transition: transform 1s ease-in-out;
|
|
*/
|
|
}
|
|
.reveal-animation.ng-enter {
|
|
-webkit-transition: .2s ease-in-out all;
|
|
-webkit-transform:translate3d(100%,0,0) ;
|
|
}
|
|
.reveal-animation.ng-enter-active {
|
|
-webkit-transform:translate3d(0,0,0) ;
|
|
}
|
|
.reveal-animation.ng-leave {
|
|
-webkit-transition: .2s ease-in-out all;
|
|
-webkit-transform:translate3d(0%,0,0);
|
|
}
|
|
.reveal-animation.ng-leave-active {
|
|
-webkit-transition: .2s ease-in-out all;
|
|
-webkit-transform:translate3d(-100%,0,0);
|
|
}
|
|
|
|
.scroll-refresher {
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
#refresh-content {
|
|
color: #999;
|
|
text-align: center;
|
|
font-size: 48px;
|
|
position: absolute;
|
|
bottom: 10px;
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
|
|
</head>
|
|
<body ng-controller="ThisCtrl">
|
|
<pane>
|
|
<header-bar id="header" title="'Title'" type="bar-primary" hides-header></header-bar>
|
|
|
|
<content id="container"
|
|
on-scroll="onScroll(event, scrollTop, scrollLeft)"
|
|
on-refresh="onRefresh()"
|
|
on-refresh-opening="onRefreshOpening(amount)"
|
|
refresh-complete="refreshComplete"
|
|
has-tabs="true"
|
|
has-header="true"
|
|
>
|
|
<refresher></refresher>
|
|
<ul class="list" ng-controller="AppCtrl">
|
|
<li class="list-item" ng-repeat="item in items">asdf{{$index}}</li>
|
|
</ul>
|
|
</content>
|
|
<nav id="tab-bar" class="tabs tabs-icon-top">
|
|
<a class="tab-item" href="#">
|
|
<i class="icon ion-game-controller-a"></i>
|
|
Fun
|
|
</a>
|
|
<a class="tab-item">
|
|
<i class="icon ion-locked"></i>
|
|
Security
|
|
</a>
|
|
<a class="tab-item">
|
|
<i class="icon ion-heart"></i>
|
|
Simple
|
|
</a>
|
|
<a class="tab-item">
|
|
<i class="icon ion-leaf"></i>
|
|
Light
|
|
</a>
|
|
<a class="tab-item">
|
|
<i class="icon ion-waterdrop"></i>
|
|
Clean
|
|
</a>
|
|
</nav>
|
|
|
|
</pane>
|
|
|
|
<script>
|
|
angular.module('navTest', ['ionic'])
|
|
|
|
.directive('hidesHeader', function() {
|
|
return {
|
|
link: function($scope, $element, $attr) {
|
|
var startTop = $element[0].offsetTop;
|
|
console.log("Starting", startTop);
|
|
}
|
|
}
|
|
})
|
|
|
|
.controller('ThisCtrl', function($scope) {
|
|
var header = document.getElementById('header');
|
|
var content = document.getElementById('container');
|
|
var startTop = header.offsetTop;
|
|
$scope.onScroll = function(event, scrollTop, scrollLeft) {
|
|
if(scrollTop > startTop) {
|
|
var diff = scrollTop - startTop;
|
|
console.log(diff);
|
|
header.style.webkitTransform = 'translate3d(0px, -' + diff + 'px, 0)';
|
|
content.style.marginTop = -diff + 'px';
|
|
}
|
|
console.log('Scroll', scrollTop, scrollLeft);
|
|
};
|
|
})
|
|
|
|
.controller('AppCtrl', function($scope, $compile, $timeout, $element) {
|
|
$scope.items = [];
|
|
for(var i = 0; i < 70; i++) {
|
|
$scope.items.push({
|
|
});
|
|
}
|
|
$timeout(function() {
|
|
$scope.scrollView.resize();
|
|
}, 1000);
|
|
})
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|