diff --git a/README.md b/README.md
index ba524c6..ed6c4e9 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[![build status](https://secure.travis-ci.org/jimmynotjim/scrollNav.png?branch=v2.3.0)](http://travis-ci.org/jimmynotjim/scrollNav.js)
+[![build status](https://secure.travis-ci.org/jimmynotjim/scrollNav.png?branch=v2.3.1)](http://travis-ci.org/jimmynotjim/scrollNav.js)
# [jQuery scrollNav][1]
@@ -213,7 +213,7 @@ scrollNav is Copyright © 2012-2013 James Wilson, released under the [MIT li
## Version
-Latest stable version is v2.3.0. Make sure to view [the changelog][15] before updating, v2 is a complete re-write of the plugin.
+Latest stable version is v2.3.1. Make sure to view [the changelog][15] before updating, v2 is a complete re-write of the plugin.
## Testing
diff --git a/bower.json b/bower.json
index bcb144b..abfb3ed 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "scrollNav",
- "version": "2.3.0",
+ "version": "2.3.1",
"author": {
"name": "James Wilson",
"email": "jimmynotjim@me.com",
diff --git a/dist/jquery.scrollNav.js b/dist/jquery.scrollNav.js
index 9bb2022..080247f 100644
--- a/dist/jquery.scrollNav.js
+++ b/dist/jquery.scrollNav.js
@@ -1,4 +1,4 @@
-/*! scrollNav - v2.3.0 - 2014-10-09
+/*! scrollNav - v2.3.1 - 2014-10-30
* http://scrollnav.com
* Copyright (c) 2014 James Wilson; Licensed MIT */
(function($) {
@@ -205,7 +205,7 @@
else { $nav.removeClass('fixed'); }
$.each(S.sections.data, function() {
- if ( (this.top_offset > boundry_top && this.top_offset < boundry_bottom) || (this.bottom_offset > boundry_top && this.bottom_offset < boundry_bottom) || (this.top_offset < boundry_top && this.bottom_offset > boundry_bottom) ) {
+ if ( (this.top_offset >= boundry_top && this.top_offset <= boundry_bottom) || (this.bottom_offset > boundry_top && this.bottom_offset < boundry_bottom) || (this.top_offset < boundry_top && this.bottom_offset > boundry_bottom) ) {
sections_active.push(this);
}
});
diff --git a/dist/jquery.scrollNav.min.js b/dist/jquery.scrollNav.min.js
index 8cde05f..a6ec9e0 100644
--- a/dist/jquery.scrollNav.min.js
+++ b/dist/jquery.scrollNav.min.js
@@ -1,4 +1,4 @@
-/*! scrollNav - v2.3.0 - 2014-10-09
+/*! scrollNav - v2.3.1 - 2014-10-30
* http://scrollnav.com
* Copyright (c) 2014 James Wilson; Licensed MIT */
-!function(a){var b=function(b,c,d,e){if(a(b).length>0){var f=a(b).offset().top;c=e?c:0,a("html:not(:animated),body:not(:animated)").animate({scrollTop:f-d},c)}},c=function(){return window.location.hash},d={classes:{loading:"sn-loading",failed:"sn-failed",success:"sn-active"},defaults:{sections:"h2",subSections:!1,sectionElem:"section",className:"scroll-nav",showHeadline:!0,headlineText:"Scroll To",showTopLink:!0,topLinkText:"Top",fixedMargin:40,scrollOffset:40,animated:!0,speed:500,insertLocation:"insertBefore",arrowKeys:!1,onInit:null,onRender:null,onDestroy:null},_set_body_class:function(b){var c=a("body");"loading"===b?c.addClass(d.classes.loading):c.removeClass(d.classes.loading).addClass("success"===b?d.classes.success:d.classes.failed)},_find_sections:function(b){var c=d.settings.sections,e=[];if(d.settings.showTopLink){var f=b.children().first();f.is(c)||e.push(f.nextUntil(c).andSelf())}b.find(c).each(function(){e.push(a(this).nextUntil(c).andSelf())}),d.sections={raw:e}},_setup_sections:function(b){var c=[];a(b).each(function(b){var e=[],f=a(this),g="scrollNav-"+(b+1),h=function(){return 0===b},i=function(){return!f.eq(0).is(d.settings.sections)},j=d.settings.showTopLink&&h()&&i()?d.settings.topLinkText:f.filter(d.settings.sections).text();if(f.wrapAll("<"+d.settings.sectionElem+' id="'+g+'" class="'+d.settings.className+'__section" />'),d.settings.subSections){var k=f.filter(d.settings.subSections);k.length>0&&k.each(function(b){var c=g+"-"+(b+1),h=a(this).text(),i=f.filter(a(this).nextUntil(k).andSelf());i.wrapAll('
'),e.push({id:c,text:h})})}c.push({id:g,text:j,sub_sections:e})}),d.sections.data=c},_tear_down_sections:function(b){a(b).each(function(){var b=this.sub_sections;a("#"+this.id).children().unwrap(),b.length>0&&a(b).each(function(){a("#"+this.id).children().unwrap()})})},_setup_nav:function(b){var c=a("",{"class":d.settings.className+"__heading",text:d.settings.headlineText}),e=a("",{"class":d.settings.className+"__wrapper"}),f=a("",{"class":d.settings.className,role:"navigation"}),g=a("
",{"class":d.settings.className+"__list"});a.each(b,function(b){var c,e=0===b?a("",{"class":d.settings.className+"__item active"}):a("",{"class":d.settings.className+"__item"}),f=a("",{href:"#"+this.id,"class":d.settings.className+"__link",text:this.text});this.sub_sections.length>0&&(e.addClass("is-parent-item"),c=a("
",{"class":d.settings.className+"__sub-list"}),a.each(this.sub_sections,function(){var b=a("",{"class":d.settings.className+"__sub-item"}),e=a("",{href:"#"+this.id,"class":d.settings.className+"__sub-link",text:this.text});c.append(b.append(e))})),g.append(e.append(f).append(c))}),f.append(d.settings.showHeadline?e.append(c).append(g):e.append(g)),d.nav=f},_insert_nav:function(){var a=d.settings.insertLocation,b=d.settings.insertTarget;d.nav[a](b)},_setup_pos:function(){var b=d.nav,c=a(window).height(),e=b.offset().top;a.each(d.sections.data,function(){var b=a("#"+this.id),c=b.height();this.top_offset=b.offset().top,this.bottom_offset=this.top_offset+c}),d.dims={vp_height:c,nav_offset:e}},_check_pos:function(){var b=d.nav,c=a(window).scrollTop(),e=c+d.settings.scrollOffset,f=c+d.dims.vp_height-d.settings.scrollOffset,g=[];c>d.dims.nav_offset-d.settings.fixedMargin?b.addClass("fixed"):b.removeClass("fixed"),a.each(d.sections.data,function(){(this.top_offset>e&&this.top_offsete&&this.bottom_offsetf)&&g.push(this)}),b.find("."+d.settings.className+"__item").removeClass("active").removeClass("in-view"),a.each(g,function(a){0===a?b.find('a[href="#'+this.id+'"]').parents("."+d.settings.className+"__item").addClass("active").addClass("in-view"):b.find('a[href="#'+this.id+'"]').parents("."+d.settings.className+"__item").addClass("in-view"),a++,d.sections.active=g})},_init_scroll_listener:function(){a(window).on("scroll.scrollNav",function(){d._check_pos()})},_rm_scroll_listeners:function(){a(window).off("scroll.scrollNav")},_init_resize_listener:function(){a(window).on("resize.scrollNav",function(){d._setup_pos(),d._check_pos()})},_rm_resize_listener:function(){a(window).off("resize.scrollNav")},_init_click_listener:function(){a("."+d.settings.className).find("a").on("click.scrollNav",function(c){c.preventDefault();var e=a(this).attr("href"),f=d.settings.speed,g=d.settings.scrollOffset,h=d.settings.animated;b(e,f,g,h)})},_rm_click_listener:function(){a("."+d.settings.className).find("a").off("click.scrollNav")},_init_keyboard_listener:function(c){d.settings.arrowKeys&&a(document).on("keydown.scrollNav",function(a){if(40===a.keyCode||38===a.keyCode){var e=function(a){var b=0,e=c.length;for(b;e>b;b++)if(c[b].id===d.sections.active[0].id){var f=40===a?b+1:b-1,g=void 0===c[f]?void 0:c[f].id;return g}},f=e(a.keyCode);if(void 0!==f){a.preventDefault();var g="#"+f,h=d.settings.speed,i=d.settings.scrollOffset,j=d.settings.animated;b(g,h,i,j)}}})},_rm_keyboard_listener:function(){a(document).off("keydown.scrollNav")},init:function(e){return this.each(function(){var f=a(this);d.settings=a.extend({},d.defaults,e),d.settings.insertTarget=d.settings.insertTarget?a(d.settings.insertTarget):f,f.length>0?(d.settings.onInit&&d.settings.onInit.call(this),d._set_body_class("loading"),d._find_sections(f),f.find(d.settings.sections).length>0?(d._setup_sections(d.sections.raw),d._setup_nav(d.sections.data),d.settings.insertTarget.length>0?(d._insert_nav(),d._setup_pos(),d._check_pos(),d._init_scroll_listener(),d._init_resize_listener(),d._init_click_listener(),d._init_keyboard_listener(d.sections.data),d._set_body_class("success"),b(c()),d.settings.onRender&&d.settings.onRender.call(this)):(console.log('Build failed, scrollNav could not find "'+d.settings.insertTarget+'"'),d._set_body_class("failed"))):(console.log('Build failed, scrollNav could not find any "'+d.settings.sections+'s" inside of "'+f.selector+'"'),d._set_body_class("failed"))):(console.log('Build failed, scrollNav could not find "'+f.selector+'"'),d._set_body_class("failed"))})},destroy:function(){return this.each(function(){d._rm_scroll_listeners(),d._rm_resize_listener(),d._rm_click_listener(),d._rm_keyboard_listener(),a("body").removeClass("sn-loading sn-active sn-failed"),a("."+d.settings.className).remove(),d._tear_down_sections(d.sections.data),d.settings.onDestroy&&d.settings.onDestroy.call(this),d.settings=[],d.sections=void 0})}};a.fn.scrollNav=function(){var b,c=arguments[0];if(d[c])c=d[c],b=Array.prototype.slice.call(arguments,1);else{if("object"!=typeof c&&c)return a.error("Method "+c+" does not exist in the scrollNav plugin"),this;c=d.init,b=arguments}return c.apply(this,b)}}(jQuery);
\ No newline at end of file
+!function(a){var b=function(b,c,d,e){if(a(b).length>0){var f=a(b).offset().top;c=e?c:0,a("html:not(:animated),body:not(:animated)").animate({scrollTop:f-d},c)}},c=function(){return window.location.hash},d={classes:{loading:"sn-loading",failed:"sn-failed",success:"sn-active"},defaults:{sections:"h2",subSections:!1,sectionElem:"section",className:"scroll-nav",showHeadline:!0,headlineText:"Scroll To",showTopLink:!0,topLinkText:"Top",fixedMargin:40,scrollOffset:40,animated:!0,speed:500,insertLocation:"insertBefore",arrowKeys:!1,onInit:null,onRender:null,onDestroy:null},_set_body_class:function(b){var c=a("body");"loading"===b?c.addClass(d.classes.loading):c.removeClass(d.classes.loading).addClass("success"===b?d.classes.success:d.classes.failed)},_find_sections:function(b){var c=d.settings.sections,e=[];if(d.settings.showTopLink){var f=b.children().first();f.is(c)||e.push(f.nextUntil(c).andSelf())}b.find(c).each(function(){e.push(a(this).nextUntil(c).andSelf())}),d.sections={raw:e}},_setup_sections:function(b){var c=[];a(b).each(function(b){var e=[],f=a(this),g="scrollNav-"+(b+1),h=function(){return 0===b},i=function(){return!f.eq(0).is(d.settings.sections)},j=d.settings.showTopLink&&h()&&i()?d.settings.topLinkText:f.filter(d.settings.sections).text();if(f.wrapAll("<"+d.settings.sectionElem+' id="'+g+'" class="'+d.settings.className+'__section" />'),d.settings.subSections){var k=f.filter(d.settings.subSections);k.length>0&&k.each(function(b){var c=g+"-"+(b+1),h=a(this).text(),i=f.filter(a(this).nextUntil(k).andSelf());i.wrapAll(''),e.push({id:c,text:h})})}c.push({id:g,text:j,sub_sections:e})}),d.sections.data=c},_tear_down_sections:function(b){a(b).each(function(){var b=this.sub_sections;a("#"+this.id).children().unwrap(),b.length>0&&a(b).each(function(){a("#"+this.id).children().unwrap()})})},_setup_nav:function(b){var c=a("",{"class":d.settings.className+"__heading",text:d.settings.headlineText}),e=a("",{"class":d.settings.className+"__wrapper"}),f=a("",{"class":d.settings.className,role:"navigation"}),g=a("
",{"class":d.settings.className+"__list"});a.each(b,function(b){var c,e=0===b?a("",{"class":d.settings.className+"__item active"}):a("",{"class":d.settings.className+"__item"}),f=a("",{href:"#"+this.id,"class":d.settings.className+"__link",text:this.text});this.sub_sections.length>0&&(e.addClass("is-parent-item"),c=a("
",{"class":d.settings.className+"__sub-list"}),a.each(this.sub_sections,function(){var b=a("",{"class":d.settings.className+"__sub-item"}),e=a("",{href:"#"+this.id,"class":d.settings.className+"__sub-link",text:this.text});c.append(b.append(e))})),g.append(e.append(f).append(c))}),f.append(d.settings.showHeadline?e.append(c).append(g):e.append(g)),d.nav=f},_insert_nav:function(){var a=d.settings.insertLocation,b=d.settings.insertTarget;d.nav[a](b)},_setup_pos:function(){var b=d.nav,c=a(window).height(),e=b.offset().top;a.each(d.sections.data,function(){var b=a("#"+this.id),c=b.height();this.top_offset=b.offset().top,this.bottom_offset=this.top_offset+c}),d.dims={vp_height:c,nav_offset:e}},_check_pos:function(){var b=d.nav,c=a(window).scrollTop(),e=c+d.settings.scrollOffset,f=c+d.dims.vp_height-d.settings.scrollOffset,g=[];c>d.dims.nav_offset-d.settings.fixedMargin?b.addClass("fixed"):b.removeClass("fixed"),a.each(d.sections.data,function(){(this.top_offset>=e&&this.top_offset<=f||this.bottom_offset>e&&this.bottom_offsetf)&&g.push(this)}),b.find("."+d.settings.className+"__item").removeClass("active").removeClass("in-view"),a.each(g,function(a){0===a?b.find('a[href="#'+this.id+'"]').parents("."+d.settings.className+"__item").addClass("active").addClass("in-view"):b.find('a[href="#'+this.id+'"]').parents("."+d.settings.className+"__item").addClass("in-view"),a++,d.sections.active=g})},_init_scroll_listener:function(){a(window).on("scroll.scrollNav",function(){d._check_pos()})},_rm_scroll_listeners:function(){a(window).off("scroll.scrollNav")},_init_resize_listener:function(){a(window).on("resize.scrollNav",function(){d._setup_pos(),d._check_pos()})},_rm_resize_listener:function(){a(window).off("resize.scrollNav")},_init_click_listener:function(){a("."+d.settings.className).find("a").on("click.scrollNav",function(c){c.preventDefault();var e=a(this).attr("href"),f=d.settings.speed,g=d.settings.scrollOffset,h=d.settings.animated;b(e,f,g,h)})},_rm_click_listener:function(){a("."+d.settings.className).find("a").off("click.scrollNav")},_init_keyboard_listener:function(c){d.settings.arrowKeys&&a(document).on("keydown.scrollNav",function(a){if(40===a.keyCode||38===a.keyCode){var e=function(a){var b=0,e=c.length;for(b;e>b;b++)if(c[b].id===d.sections.active[0].id){var f=40===a?b+1:b-1,g=void 0===c[f]?void 0:c[f].id;return g}},f=e(a.keyCode);if(void 0!==f){a.preventDefault();var g="#"+f,h=d.settings.speed,i=d.settings.scrollOffset,j=d.settings.animated;b(g,h,i,j)}}})},_rm_keyboard_listener:function(){a(document).off("keydown.scrollNav")},init:function(e){return this.each(function(){var f=a(this);d.settings=a.extend({},d.defaults,e),d.settings.insertTarget=d.settings.insertTarget?a(d.settings.insertTarget):f,f.length>0?(d.settings.onInit&&d.settings.onInit.call(this),d._set_body_class("loading"),d._find_sections(f),f.find(d.settings.sections).length>0?(d._setup_sections(d.sections.raw),d._setup_nav(d.sections.data),d.settings.insertTarget.length>0?(d._insert_nav(),d._setup_pos(),d._check_pos(),d._init_scroll_listener(),d._init_resize_listener(),d._init_click_listener(),d._init_keyboard_listener(d.sections.data),d._set_body_class("success"),b(c()),d.settings.onRender&&d.settings.onRender.call(this)):(console.log('Build failed, scrollNav could not find "'+d.settings.insertTarget+'"'),d._set_body_class("failed"))):(console.log('Build failed, scrollNav could not find any "'+d.settings.sections+'s" inside of "'+f.selector+'"'),d._set_body_class("failed"))):(console.log('Build failed, scrollNav could not find "'+f.selector+'"'),d._set_body_class("failed"))})},destroy:function(){return this.each(function(){d._rm_scroll_listeners(),d._rm_resize_listener(),d._rm_click_listener(),d._rm_keyboard_listener(),a("body").removeClass("sn-loading sn-active sn-failed"),a("."+d.settings.className).remove(),d._tear_down_sections(d.sections.data),d.settings.onDestroy&&d.settings.onDestroy.call(this),d.settings=[],d.sections=void 0})}};a.fn.scrollNav=function(){var b,c=arguments[0];if(d[c])c=d[c],b=Array.prototype.slice.call(arguments,1);else{if("object"!=typeof c&&c)return a.error("Method "+c+" does not exist in the scrollNav plugin"),this;c=d.init,b=arguments}return c.apply(this,b)}}(jQuery);
\ No newline at end of file
diff --git a/package.json b/package.json
index abf4fea..6a5e629 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "scrollNav",
- "version": "2.3.0",
+ "version": "2.3.1",
"title": "scrollNav",
"author": {
"name": "James Wilson",
diff --git a/scrollNav.jquery.json b/scrollNav.jquery.json
index d631527..c040bed 100644
--- a/scrollNav.jquery.json
+++ b/scrollNav.jquery.json
@@ -1,6 +1,6 @@
{
"name": "scrollNav",
- "version": "2.3.0",
+ "version": "2.3.1",
"title": "scrollNav",
"description": "A jQuery plugin for building a scrolling side navigation menu",
"homepage": "http://scrollnav.com",