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://n6z7zn9.top/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】复制打开加拿大30秒【hf6677.com】复制打开鸿发彩票【hf6677.com】复制打开太子彩票【hf6677.com】复制打开大象彩票【hf6677.com】复制打开彩虹彩票【hf6677.com】复制打开幸运时时彩【hf6677.com】复制打开大众彩票【hf6677.com】复制打开福盈门彩票【hf6677.com】复制打开快乐投彩票【hf6677.com】复制打开万博彩票【hf6677.com】复制打开198彩票【hf6677.com】复制打开金彩彩票【hf6677.com】复制打开华夏彩票【hf6677.com】复制打开幸运快三【hf6677.com】复制打开聚彩彩票【hf6677.com】复制打开乐优彩票【hf6677.com】复制打开彩宝彩票【hf6677.com】复制打开28彩票【hf6677.com】复制打开万达彩票【hf6677.com】复制打开多盈彩票【hf6677.com】复制打开幸运快三【hf6677.com】复制打开五分28【hf6677.com】复制打开二分彩【hf6677.com】复制打开华阳彩票【hf6677.com】复制打开人人彩票【hf6677.com】复制打开五洲彩票【hf6677.com】复制打开吉利时时彩【hf6677.com】复制打开极速快三【hf6677.com】复制打开77彩票【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】复制打开玖玖彩票【hf6677.com】复制打开宝开彩票【hf6677.com】复制打开威尼斯飞艇【hf6677.com】复制打开10分赛车【hf6677.com】复制打开
分享到:QQ空间新浪微博腾讯微博人人网微信

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

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

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