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>

特马诗竞猜图

北京快乐8【永久网址6933.com】AG捕鱼王【上官网:1560.vip】山西快3【到官网3611.com】全民彩票【上官网:1560.vip】极速快乐十分【永久网址6933.com】百人牛牛【复制打开8165.com】加拿大时时彩【复制打开8165.com】竞技狂热【永久网址6933.com】迪士尼彩票【复制打开8165.com】极速快乐十分【复制打开8165.com】水果拉霸多人版【上官网:1560.vip】北京快乐8【上官网:1560.vip】天津快三开奖结果【上官网:1560.vip】pk10【上官网:1560.vip】AG体育【到官网3611.com】安徽快三开奖结果【上官网:1560.vip】香港六合彩【到官网3611.com】北京赛车pk10开奖走势图【永久网址6933.com】BG西游大师【到官网3611.com】福建快3【到官网3611.com】大地彩票【复制打开8165.com】幸运时时彩【复制打开8165.com】pc蛋蛋【上官网:1560.vip】幸运28【上官网:1560.vip】平安彩票网【到官网3611.com】秒速飞艇【永久网址6933.com】添彩网【到官网3611.com】OG真人【永久网址6933.com】满堂彩【上官网:1560.vip】博九彩票【永久网址6933.com】BD西游捕鱼【到官网3611.com】荣鼎彩票【复制打开8165.com】快乐时时彩【上官网:1560.vip】北京赛车pk10开奖结果【上官网:1560.vip】75秒时时彩【到官网3611.com】陕西快三开奖结果【永久网址6933.com】幸运六合彩【上官网:1560.vip】北京赛车pk10开奖走势图【上官网:1560.vip】水果拉霸【到官网3611.com】平安彩票网【复制打开8165.com】加拿大28【上官网:1560.vip】恒达集团【永久网址6933.com】皇冠体育【到官网3611.com】祥龙彩乐园【到官网3611.com】pc蛋蛋【永久网址6933.com】西瓜彩票【上官网:1560.vip】秒速飞艇【到官网3611.com】澳门百家乐【上官网:1560.vip】幸运飞艇【永久网址6933.com】极速飞艇【复制打开8165.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>