Files
ionic-framework/js/ext/angular/test/content.html
2014-03-18 15:57:13 -05:00

131 lines
4.0 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.bundle.js"></script>
</head>
<body ng-controller="ThisCtrl">
<ion-pane>
<ion-header-bar id="header" class="bar-primary">
<h1 class="title">Title</h1>
</ion-header-bar>
<ion-content id="container"
start-y="55"
on-scroll="onScroll(event, scrollTop, scrollLeft)"
on-scroll-complete="onScrollComplete(scrollTop, scrollLeft)"
on-refresh="onRefresh()"
on-refresh-opening="onRefreshOpening(amount)"
padding="true"
has-tabs="true"
has-header="true"
>
<ion-refresher></ion-refresher>
<div id="search-box" class="bar bar-header item-input-inset">
<label class="item-input-wrapper">
<i class="icon ion-ios7-search placeholder-icon"></i>
<input type="search" placeholder="Search">
</label>
<button class="button button-clear">
Cancel
</button>
</div>
<div ng-controller="TestCtrl"></div>
<button ng-click="add()">Click</button>
<ul class="list" ng-controller="AppCtrl">
<li class="list-item" ng-repeat="item in items">asdf{{$index}}</li>
</ul>
<input type="text" placeholder="INPUT TEXT">
</ion-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>
</ion-pane>
<script>
angular.module('navTest', ['ionic'])
.directive('hidesHeader', function() {
return {
link: function($scope, $element, $attr) {
var startTop = $element[0].offsetTop;
}
}
})
.controller('TestCtrl', function($scope, $timeout, $ionicScrollDelegate) {
var delegate = $ionicScrollDelegate($scope);
console.log('CONSTRUCT');
$timeout(function() {
var view = delegate.getScrollView($scope);
console.log(view);
});
})
.controller('ThisCtrl', function($scope, $timeout, $ionicScrollDelegate) {
var delegate = $ionicScrollDelegate($scope);
var header = document.getElementById('header');
var content = document.getElementById('container');
var startTop = header.offsetTop;
$scope.onScrollComplete = function(event, scrollTop, scrollLeft) {
}
$scope.add = function() {
console.log('Adding!');
};
var last = 0;
$scope.onRefresh = function() {
$timeout(function() {
delegate.finishRefreshing($scope);
}, 1000);
};
$scope.onScroll = function(event, scrollTop, scrollLeft) {
/*
if(scrollTop > startTop) {
var diff = scrollTop - startTop;
console.log(diff);
header.style[ionic.CSS.TRANSFORM] = '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({
});
}
})
</script>
</body>
</html>