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://3g.wnxtjc.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>

全民竞猜币有

印尼分分彩^^登入盛大官网:sd7799.com^^腾讯3分彩开奖结果【永久网址3611.com】开心飞艇【永久网址6933.com】加拿大幸运5^^登入盛大官网:sd7799.com^^比特币1分彩开奖结果【登入鼎盛:ds96.com】秒速飞艇【永久网址6933.com】五分重庆时时彩【永久网址6933.com】快乐28开奖结果【登入鼎盛:ds96.com】北京pk10开奖结果【登入鼎盛:ds96.com】加拿大28开奖结果【登入鼎盛:ds96.com】1分快三^^登入盛大官网:sd7799.com^^3分彩【永久网址6933.com】1分快3【永久网址6933.com】三分pc蛋蛋开奖结果【登入鼎盛:ds96.com】台湾时时彩开奖结果【永久网址3611.com】东京28开奖结果【登入鼎盛:ds96.com】1分11选5^^登入盛大官网:sd7799.com^^罗马时时彩^^登入盛大官网:sd7799.com^^极速pc蛋蛋^^登入盛大官网:sd7799.com^^10分彩^^登入盛大官网:sd7799.com^^幸运北京赛车【永久网址6933.com】悉尼幸运28^^登入盛大官网:sd7799.com^^台湾宾果pc28【永久网址6933.com】3分彩^^登入盛大官网:sd7799.com^^澳门网上赌场网站^^登入盛大官网:sd7799.com^^加拿大30秒【永久网址6933.com】飞速赛车^^登入盛大官网:sd7799.com^^大发六合彩开奖结果【永久网址3611.com】重庆pc28开奖结果【永久网址3611.com】75秒快3开奖结果【永久网址3611.com】QQ分分彩开奖结果【永久网址3611.com】北京赛车pk10开奖结果【登入鼎盛:ds96.com】极速pc蛋蛋【永久网址6933.com】VR赛车【永久网址6933.com】极速六合彩^^登入盛大官网:sd7799.com^^分分pk10开奖结果【登入鼎盛:ds96.com】十分快三^^登入盛大官网:sd7799.com^^加拿大幸运5^^登入盛大官网:sd7799.com^^秒秒彩【永久网址6933.com】北京赛车开奖结果【登入鼎盛:ds96.com】秒速赛车【永久网址6933.com】极速快三开奖结果【永久网址3611.com】三分赛车^^登入盛大官网:sd7799.com^^澳门时时彩^^登入盛大官网:sd7799.com^^重庆幸运农场开奖结果【永久网址3611.com】快乐pk10^^登入盛大官网:sd7799.com^^幸运六合彩^^登入盛大官网:sd7799.com^^菲律宾五分彩开奖结果【登入鼎盛:ds96.com】一分pc蛋蛋开奖结果【永久网址3611.com】幸运农场开奖结果【登入鼎盛:ds96.com】
分享到:QQ空间新浪微博腾讯微博人人网微信

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

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

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