Skip to content

Commit

Permalink
Upped the version to 1.0.3. Moved the scrollTop limiter to the Frame …
Browse files Browse the repository at this point in the history
…Loop.
  • Loading branch information
RobertoGonzalez committed Sep 30, 2014
1 parent b1e4bad commit 6747aab
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "midnight",
"version": "1.0.1",
"version": "1.0.3",
"description": "Switch fixed headers on the fly",
"main": "midnight.jquery.js",
"homepage": "https://github.com/Aerolab/midnight.js",
Expand Down
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@


<div class="top-links" data-midnight="white">
<a class="button" href="https://aerolab.github.io/midnight.js/midnight.jquery.js" download>Download</a>
<a class="button" href="https://aerolab.github.io/midnight.js/midnight.jquery.min.js" download>Download</a>
<a class="button button-github" href="https://github.com/Aerolab/midnight.js" target="_blank">Fork on GitHub</a>
</div>

Expand Down Expand Up @@ -172,7 +172,7 @@ <h2>The jQuery Plugin</h2>
<p>To make everything work, just load midnight (and jQuery) and initialize it. We take care of the rest.</p>
</div>

<pre class="line-numbers wow fadeInRight"><code class="language-markup">&lt;script src="midnight.jquery.js"&gt;&lt;/script&gt;
<pre class="line-numbers wow fadeInRight"><code class="language-markup">&lt;script src="midnight.jquery.min.js"&gt;&lt;/script&gt;
&lt;script&gt;
// Start midnight
$(document).ready(function(){
Expand Down Expand Up @@ -224,7 +224,7 @@ <h2>Further customization</h2>

<div class="container">
<div class="buttons wow fadeIn">
<a class="button" href="https://aerolab.github.io/midnight.js/midnight.jquery.js" download>Download</a>
<a class="button" href="https://aerolab.github.io/midnight.js/midnight.jquery.min.js" download>Download</a>
<a class="button" href="https://github.com/Aerolab/midnight.js" target="_blank"><i class="icon-github"></i> Fork on GitHub</a>
</div>
</div>
Expand All @@ -243,7 +243,7 @@ <h2>Further customization</h2>
<script src="assets/js/prism.js"></script>
<script src="assets/js/wow.min.js"></script>
<script src="assets/js/viewport-units-buggyfill.js"></script>
<script src="midnight.jquery.js"></script>
<script src="midnight.jquery.min.js"></script>
<script>


Expand Down
7 changes: 5 additions & 2 deletions midnight.jquery.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Midnight.js 1.0.2
* Midnight.js 1.0.3
* jQuery plugin to switch between multiple fixed header designs on the fly, so it looks in line with the content below it.
* http://aerolab.github.io/midnight.js/
*
Expand Down Expand Up @@ -37,6 +37,7 @@

// Scroll Cache
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
var documentHeight = $(document).height();

// Cache all the switchable headers (different colors)
var $originalHeader = $(this);
Expand Down Expand Up @@ -232,6 +233,8 @@

var recalculateSections = function(){

documentHeight = $(document).height();

// Cache all the sections and their start/end positions (where the class starts and ends)
sections = [];

Expand Down Expand Up @@ -260,7 +263,7 @@
scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
// Some browsers (e.g on OS X) allow scrolling past the top/bottom.
scrollTop = Math.max(scrollTop, 0);
scrollTop = Math.min(scrollTop, $(document).height());
scrollTop = Math.min(scrollTop, documentHeight);

// Get the header's position relative to the document (given that it's fixed)
var headerHeight = headerInfo.height;
Expand Down
4 changes: 2 additions & 2 deletions midnight.jquery.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions midnight.jquery.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

// Scroll Cache
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
var documentHeight = $(document).height();

// Cache all the switchable headers (different colors)
var $originalHeader = $(this);
Expand Down Expand Up @@ -222,6 +223,8 @@

var recalculateSections = function(){

documentHeight = $(document).height();

// Cache all the sections and their start/end positions (where the class starts and ends)
sections = [];

Expand All @@ -248,6 +251,9 @@

// Check classes are currently active in the header (including the current percentage of each)
scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
// Some browsers (e.g on OS X) allow scrolling past the top/bottom.
scrollTop = Math.max(scrollTop, 0);
scrollTop = Math.min(scrollTop, documentHeight);

// Get the header's position relative to the document (given that it's fixed)
var headerHeight = headerInfo.height;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Midnight.JS",
"version": "1.0.2",
"version": "1.0.3",
"description": "A jQuery plugin to switch fixed headers on the fly",
"devDependencies": {
"gulp": "^3.8.8",
Expand Down

0 comments on commit 6747aab

Please sign in to comment.