mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
78 lines
2.7 KiB
HTML
78 lines
2.7 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>
|
|
</head>
|
|
<body ng-controller="ThisCtrl">
|
|
<pane>
|
|
<header-bar id="header" title="'Title'" type="bar-primary" hides-header></header-bar>
|
|
|
|
<content has-header="true" scroll="false">
|
|
<scroll direction="x" style="width: 100%">
|
|
<div style="height: 100px; width: 4000px; background: url('tree_bark.png') repeat"></div>
|
|
</scroll>
|
|
<scroll direction="y" style="height: 400px; width: 300px">
|
|
<div style="width: 100px; height: 4000px; background: url('tree_bark.png') repeat"></div>
|
|
</scroll>
|
|
</content>
|
|
</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.onScrollComplete = function(event, scrollTop, scrollLeft) {
|
|
console.log('Scroll complete', scrollTop, scrollLeft);
|
|
}
|
|
$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>
|
|
|