Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add easing option

  • Loading branch information...
commit 5350d2e2fc086ed8b29149db20e75a85204945ac 1 parent 82fc8c0
@davist11 authored
Showing with 8 additions and 5 deletions.
  1. +1 −0  README.markdown
  2. +3 −1 jquery.nav.js
  3. +4 −4 jquery.nav.min.js
View
1  README.markdown
@@ -28,6 +28,7 @@ The plugin still works even if you add additional content to the page after the
changeHash: false,
scrollSpeed: 750,
scrollOffset: 30,
+ easing: 'swing',
begin: function() {
console.log('I get fired when the animation is starting');
},
View
4 jquery.nav.js
@@ -7,7 +7,7 @@
* Uses the same license as jQuery, see:
* http://jquery.org/license
*
- * @version 0.7
+ * @version 0.8
*
* Example usage:
* $('#nav').onePageNav({
@@ -35,6 +35,7 @@
onePageNav.adjustNav($this, $par, o.currentClass);
$win.unbind('.onePageNav');
$.scrollTo(newLoc, o.scrollSpeed, {
+ easing: o.easing,
offset: {
top: -o.scrollOffset
},
@@ -126,6 +127,7 @@
$.fn.onePageNav.defaults = {
currentClass: 'current',
changeHash: false,
+ easing: 'swing',
scrollSpeed: 750,
scrollOffset: 0,
begin: false,
View
8 jquery.nav.min.js
@@ -7,8 +7,8 @@
* Uses the same license as jQuery, see:
* http://jquery.org/license
*
- * @version 0.7
+ * @version 0.8
*/
-(function(e){e.fn.onePageNav=function(j){var g=e.extend({},e.fn.onePageNav.defaults,j),c={};c.sections={};c.bindNav=function(b,d,a){var f=b.parent(),h=b.attr("href"),i=e(window);if(!f.hasClass(a.currentClass)){a.begin&&a.begin();c.adjustNav(d,f,a.currentClass);i.unbind(".onePageNav");e.scrollTo(h,a.scrollSpeed,{offset:{top:-a.scrollOffset},onAfter:function(){if(a.changeHash)window.location.hash=h;i.bind("scroll.onePageNav",function(){c.scrollChange(d,a)});a.end&&a.end()}})}};c.adjustNav=function(b,
-d,a){b.find("."+a).removeClass(a);d.addClass(a)};c.getPositions=function(b,d){b.find("a").each(function(){var a=e(this).attr("href"),f=e(a).offset();f=f.top;c.sections[a.substr(1)]=Math.round(f)-d.scrollOffset})};c.getSection=function(b){var d="",a=Math.round(e(window).height()/2);for(var f in c.sections)if(c.sections[f]-a<b)d=f;return d};c.scrollChange=function(b,d){c.getPositions(b,d);var a=e(window).scrollTop();a=c.getSection(a);a!==""&&c.adjustNav(b,b.find("a[href=#"+a+"]").parent(),d.currentClass)};
-c.init=function(b,d){var a=false;b.find("a").bind("click",function(f){c.bindNav(e(this),b,d);f.preventDefault()});c.getPositions(b,d);e(window).bind("scroll.onePageNav",function(){a=true});setInterval(function(){if(a){a=false;c.scrollChange(b,d)}},250)};return this.each(function(){var b=e(this),d=e.meta?e.extend({},g,b.data()):g;c.init(b,d)})};e.fn.onePageNav.defaults={currentClass:"current",changeHash:false,scrollSpeed:750,scrollOffset:0,begin:false,end:false}})(jQuery);
+(function(e){e.fn.onePageNav=function(j){var g=e.extend({},e.fn.onePageNav.defaults,j),c={};c.sections={};c.bindNav=function(b,d,a){var f=b.parent(),h=b.attr("href"),i=e(window);if(!f.hasClass(a.currentClass)){a.begin&&a.begin();c.adjustNav(d,f,a.currentClass);i.unbind(".onePageNav");e.scrollTo(h,a.scrollSpeed,{easing:a.easing,offset:{top:-a.scrollOffset},onAfter:function(){if(a.changeHash)window.location.hash=h;i.bind("scroll.onePageNav",function(){c.scrollChange(d,a)});a.end&&a.end()}})}};c.adjustNav=
+function(b,d,a){b.find("."+a).removeClass(a);d.addClass(a)};c.getPositions=function(b,d){b.find("a").each(function(){var a=e(this).attr("href"),f=e(a).offset();f=f.top;c.sections[a.substr(1)]=Math.round(f)-d.scrollOffset})};c.getSection=function(b){var d="",a=Math.round(e(window).height()/2);for(var f in c.sections)if(c.sections[f]-a<b)d=f;return d};c.scrollChange=function(b,d){c.getPositions(b,d);var a=e(window).scrollTop();a=c.getSection(a);a!==""&&c.adjustNav(b,b.find("a[href=#"+a+"]").parent(),
+d.currentClass)};c.init=function(b,d){var a=false;b.find("a").bind("click",function(f){c.bindNav(e(this),b,d);f.preventDefault()});c.getPositions(b,d);e(window).bind("scroll.onePageNav",function(){a=true});setInterval(function(){if(a){a=false;c.scrollChange(b,d)}},250)};return this.each(function(){var b=e(this),d=e.meta?e.extend({},g,b.data()):g;c.init(b,d)})};e.fn.onePageNav.defaults={currentClass:"current",changeHash:false,easing:"swing",scrollSpeed:750,scrollOffset:0,begin:false,end:false}})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.