This widget helps build headers that can be used as a navigate bar, especially in mobile pages.
<header data-am-widget="header"
class="am-header am-header-default">
<div class="am-header-left am-header-nav">
<a href="#left-link" class="">
<i class="am-header-icon am-icon-home"></i>
</a>
</div>
<h1 class="am-header-title">
<a href="#title-link" class="">
Amaze UI
</a>
</h1>
<div class="am-header-right am-header-nav">
<a href="#right-link" class="">
<i class="am-header-icon am-icon-bars"></i>
</a>
</div>
</header>
<header data-am-widget="header"
class="am-header am-header-default">
<div class="am-header-left am-header-nav">
<a href="#left-link" class="">
<img class="am-header-icon-custom" src="data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 20"><path d="M10,0l2,2l-8,8l8,8l-2,2L0,10L10,0z" fill="%23fff"/></svg>" alt=""/>
</a>
</div>
<h1 class="am-header-title">
<img src="https://amazeui.github.io/media/i/brand/amazeui-cw.png" />
</h1>
<div class="am-header-right am-header-nav">
<a href="#right-link" class="">
<img class="am-header-icon-custom" src="data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 42 26" fill="%23fff"><rect width="4" height="4"/><rect x="8" y="1" width="34" height="2"/><rect y="11" width="4" height="4"/><rect x="8" y="12" width="34" height="2"/><rect y="22" width="4" height="4"/><rect x="8" y="23" width="34" height="2"/></svg>" alt=""/>
</a>
</div>
</header>
<header data-am-widget="header"
class="am-header am-header-default">
<div class="am-header-left am-header-nav">
<a href="#left-link" class="">
<span class="am-header-nav-title">
首页
</span>
<i class="am-header-icon am-icon-home"></i>
</a>
</div>
<h1 class="am-header-title">
Amaze UI
</h1>
<div class="am-header-right am-header-nav">
<a href="#right-link" class="">
<span class="am-header-nav-title">
菜单
</span>
<i class="am-header-icon am-icon-bars"></i>
</a>
</div>
</header>
<header data-am-widget="header"
class="am-header am-header-default">
<div class="am-header-left am-header-nav">
<a href="#left-link" class="">
<i class="am-header-icon am-icon-home"></i>
</a>
<a href="#phone-link" class="">
<i class="am-header-icon am-icon-phone"></i>
</a>
</div>
<h1 class="am-header-title">
Amaze UI
</h1>
<div class="am-header-right am-header-nav">
<a href="#user-link" class="">
<i class="am-header-icon am-icon-user"></i>
</a>
<a href="#cart-link" class="">
<i class="am-header-icon am-icon-shopping-cart"></i>
</a>
</div>
</header>
<header data-am-widget="header"
class="am-header am-header-default">
<div class="am-header-left am-header-nav">
<a href="#left-link" class="am-btn am-btn-default">
<span class="am-header-nav-title">
返回
</span>
<i class="am-header-icon am-icon-home"></i>
</a>
</div>
<h1 class="am-header-title">
Amaze UI
</h1>
<div class="am-header-right am-header-nav">
<a href="#user-link" class="">
<i class="am-header-icon am-icon-user"></i>
</a>
<a href="#cart-link" class="am-btn am-btn-secondary">
<i class="am-header-icon am-icon-shopping-cart"></i>
</a>
</div>
</header>
Add the .am-header-fixed
class to the default style.
Default style:
.am-header-fixed {
position: fixed;
top: 0;
left: 0;
right: 0;
width: 100%;
z-index: 1010;
}
<header data-am-widget="header" class="am-header am-header-default am-header-fixed">
<div class="am-header-left am-header-nav">
<a href="#left-link" class="">
<i class="am-header-icon am-icon-home"></i>
</a>
</div>
<h1 class="am-header-title">
<a href="#title-link">Amaze UI</a>
</h1>
<div class="am-header-right am-header-nav">
<a href="#right-link" class="">
<i class="am-header-icon am-icon-bars"></i>
</a>
</div>
</header>
If there is an header fixed to the top of a page, our JS will add the .am-with-fixed-header
class to the <body>
, which has a top padding of 49px. This padding can be adjusted according to the need in the project.
.am-with-fixed-header {
padding-top: @am-header-height;
}
<body>
of the Amaze UI HTML template(Download);The Handlebars partial of this widget is header
. See Accordion for more details.
Data binding
button on the right panel, and bind data using following format.var data = {
"left": [
{
"link": "", // url : http://xxx.xxx.xxx
"title": "", // Text of the link.
"icon": "", // Name of icons in Amaze UI font icon: http://www.amazeui.org/css/icon
"customIcon": "" // URL of customized icon. If this is set a value, the icon above will not be shown.
}
],
"title": "", //Title. Support HTML.
"right": [ // Same as the left
{
"link": "",
"title": "",
"icon": "",
"customIcon": ""
}
]
};
return data;
{
"id": "",
"className": "",
"theme": "",
"options": {
"fixed": false
},
"content": {
"left": [{
"link": "",
"title": "",
"icon": "",
"customIcon": "",
"className": ""
}],
"title": "",
"right": [{
"link": "",
"title": "",
"icon": "",
"customIcon": "",
"className": ""
}]
}
}