Amaze UI 2.4

Web Components

Header


This widget helps build headers that can be used as a navigate bar, especially in mobile pages.

Demos

Theme: default

  <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>

Theme: default

  <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,&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 12 20&quot;&gt;&lt;path d=&quot;M10,0l2,2l-8,8l8,8l-2,2L0,10L10,0z&quot; fill=&quot;%23fff&quot;/&gt;&lt;/svg&gt;" 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,&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 42 26&quot; fill=&quot;%23fff&quot;&gt;&lt;rect width=&quot;4&quot; height=&quot;4&quot;/&gt;&lt;rect x=&quot;8&quot; y=&quot;1&quot; width=&quot;34&quot; height=&quot;2&quot;/&gt;&lt;rect y=&quot;11&quot; width=&quot;4&quot; height=&quot;4&quot;/&gt;&lt;rect x=&quot;8&quot; y=&quot;12&quot; width=&quot;34&quot; height=&quot;2&quot;/&gt;&lt;rect y=&quot;22&quot; width=&quot;4&quot; height=&quot;4&quot;/&gt;&lt;rect x=&quot;8&quot; y=&quot;23&quot; width=&quot;34&quot; height=&quot;2&quot;/&gt;&lt;/svg&gt;" alt=""/>
          </a>
      </div>
  </header>

Theme: default

  <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>

Theme: default

Amaze UI

  <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>

Theme: default

Amaze UI

  <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>

Fix top

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;
}

Usage

Copy and Paste

  • Copy the codes in examples, and paste it to the <body> of the Amaze UI HTML template(Download);
  • Replace the contents in examples with your own contents.

Using Handlebars

The Handlebars partial of this widget is header. See Accordion for more details.

Allmobilize WebIDE

  • Drag the widget to the edit interface;
  • Click the 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;

Data Interface

{
  "id": "",

  "className": "",

  "theme": "",

  "options": {
    "fixed": false
  },

  "content": {
    "left": [{
        "link": "",
        "title": "",
        "icon": "",
        "customIcon": "",
        "className": ""
    }],

    "title": "",

    "right": [{
        "link": "",
        "title": "",
        "icon": "",
        "customIcon": "",
        "className": ""
    }]
  }
}
侧栏导航
Amaze UI 微信
在微信上关注我们