mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 06:09:31 +08:00
55 lines
1.7 KiB
HTML
55 lines
1.7 KiB
HTML
<html ng-app="headerTest">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Header</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/ionic-angular.js"></script>
|
|
</head>
|
|
<body ng-controller="TestCtrl">
|
|
<header-bar
|
|
title="headerTitle"
|
|
left-buttons="leftButtons"
|
|
right-buttons="rightButtons"
|
|
type="bar-primary"></header-bar>
|
|
|
|
<content has-header="true">
|
|
<input type="text" ng-model="headerTitle">
|
|
</content>
|
|
<script>
|
|
angular.module('headerTest', ['ionic'])
|
|
|
|
.controller('TestCtrl', function($scope) {
|
|
$scope.headerTitle = 'A really long title here';
|
|
$scope.leftButtons = [
|
|
{
|
|
text: 'Hello',
|
|
click: function(e) {
|
|
console.log('Click button');
|
|
}
|
|
}
|
|
]
|
|
});
|
|
var midPoint = window.clientWidth / 2;
|
|
var box = document.createElement('div');
|
|
box.style.backgroundColor = 'red';
|
|
box.style.opacity = '0.6';
|
|
box.style.width = '2px';
|
|
box.style.height = '44px';
|
|
box.style.left = '50%';
|
|
box.style.position = 'fixed';
|
|
box.style.zIndex = 100;
|
|
box.style.top = '0px';
|
|
box.style.marginLeft = '-1px';
|
|
document.body.appendChild(box);
|
|
window.onresize = function() {
|
|
var s = angular.element(document.getElementsByTagName('header')[0]).isolateScope();
|
|
s.headerBarView.align();
|
|
};
|
|
</script>
|
|
</body>
|
|
</html>
|