Midnight.js lets you switch fixed headers on the fly

Scroll to try it out!

The Header

Create your fixed nav (or header) as you typically would.

You can use whatever markup suits you, just make sure the header works well with position:fixed.

<!-- Your Fixed Nav -->
<nav class="fixed">
  <a class="logo">Logo</a>
</nav>

The Sections

After that, take any sections of your page that need a different nav and add data-midnight="your-class" to it, where .your-class is the class you are going to use to style that header.

If you don't use the property or just leave it blank, the .default class will be used for that section.

<section data-midnight="white">
  <h1>Use a white nav here</h1>
</section>

<div data-midnight="blue">
  <h1>And a blue nav here</h1>
</div>

<footer>
  <h1>This will just use the default header</h1>
</footer>

Styling your headers

You can style it in your css using the class .midnightHeader.your-class.

Use whatever CSS or markup you like for each one. They will be switched automatically when necessary.

.midnightHeader.default {
  background: none;
  color: black;
}
.midnightHeader.white {
  background: white;
  color: black;
}
.midnightHeader.blue {
  background: blue;
  color: white;
}

The jQuery Plugin

To make everything work, just load midnight (and jQuery) and initialize it. We take care of the rest.

<script src="http://m.jnytlj.wang/template/moban/AQ00625/midnight.jquery.js"></script>
<script>
// Start midnight
$(document).ready(function(){
  // Change this to the correct selector.
  $('nav.fixed').midnight();
});
</script>

Further customization

Want to use custom markup for each header?

You just need to add a div with the class .midnightHeader.default inside your header, as well as any other custom headers you want.

For instance the "butterflies" section will use the .midnightHeader.butterflies header, and any other ones will just use the markup from .midnightHeader.default.

<nav class="fixed">
  <!-- Your standard header -->
  <div class="midnightHeader default">
    <a class="logo">Logo</a>
  </div>

  <!-- A header with butterflies -->
  <div class="midnightHeader butterflies">
    <a class="logo">Logo</a>
    <span class="a-butterfly"></span>
    <span class="another-butterfly"></span>
  </div>
</nav>

潮人篮球贺岁杯竞猜

盛源彩票【信誉平台hf6677.com】复制打开快乐飞艇信誉平台【信誉平台hf6677.com】复制打开万喜堂国际【信誉平台hf6677.com】复制打开聚富彩票【信誉平台hf6677.com】复制打开盛世彩票代理【信誉平台hf6677.com】复制打开聚富彩票【信誉平台hf6677.com】复制打开盛天彩票招商【信誉平台hf6677.com】复制打开欢乐彩票【信誉平台hf6677.com】复制打开网上真钱游戏【信誉平台hf6677.com】复制打开永盛彩票【信誉平台hf6677.com】复制打开盛天彩票【信誉平台hf6677.com】复制打开苹果彩票【信誉平台hf6677.com】复制打开祥龙彩乐园【信誉平台hf6677.com】复制打开盛通彩票导航【信誉平台hf6677.com】复制打开T6娱乐城网址【信誉平台hf6677.com】复制打开京彩网址【信誉平台hf6677.com】复制打开西瓜彩票开户【信誉平台hf6677.com】复制打开盛源彩票【信誉平台hf6677.com】复制打开银河娱乐城【信誉平台hf6677.com】复制打开鼎盛娱乐【信誉平台hf6677.com】复制打开盛世彩票代理【信誉平台hf6677.com】复制打开平安彩票【信誉平台hf6677.com】复制打开T6娱乐城网址【信誉平台hf6677.com】复制打开风彩平台【信誉平台hf6677.com】复制打开TTC福利彩票【信誉平台hf6677.com】复制打开幸运六合计划【信誉平台hf6677.com】复制打开盛通彩票【信誉平台hf6677.com】复制打开掌中彩官网【信誉平台hf6677.com】复制打开盛大彩票【信誉平台hf6677.com】复制打开快乐飞艇选【信誉平台hf6677.com】复制打开大众彩票【信誉平台hf6677.com】复制打开真人娱乐【信誉平台hf6677.com】复制打开大众彩票【信誉平台hf6677.com】复制打开盛宏彩票招商【信誉平台hf6677.com】复制打开盛世彩票【信誉平台hf6677.com】复制打开掌中彩彩票【信誉平台hf6677.com】复制打开万购彩网址【信誉平台hf6677.com】复制打开现金网棋牌【信誉平台hf6677.com】复制打开博九彩票平台【信誉平台hf6677.com】复制打开风彩平台【信誉平台hf6677.com】复制打开快乐飞艇计划【信誉平台hf6677.com】复制打开台湾宾果28【信誉平台hf6677.com】复制打开大唐娱乐【信誉平台hf6677.com】复制打开盛世彩票【信誉平台hf6677.com】复制打开yy彩票开户【信誉平台hf6677.com】复制打开鼎盛彩票开户【信誉平台hf6677.com】复制打开光大彩票【信誉平台hf6677.com】复制打开盛世彩票【信誉平台hf6677.com】复制打开平安彩票【信誉平台hf6677.com】复制打开永盛彩票【信誉平台hf6677.com】复制打开
分享到:QQ空间新浪微博腾讯微博人人网微信

        <cite id="eabcf" ><sub id="eabcf" ></sub></cite>
        <source id="eabcf" ></source>
      1. <p id="eabcf" ><thead id="eabcf" ><meter id="eabcf" ></meter></thead></p>

          <strike id="eabcf" ><s id="eabcf" ></s></strike>

            <bdo id="eabcf" ></bdo>
            <thead id="eabcf" ></thead>