From 11668bd900d6180ac1d01f66b49f44d4aa13f9fe Mon Sep 17 00:00:00 2001
From: Karl Swedberg
Date: Thu, 19 Sep 2013 14:37:15 -0400
Subject: [PATCH 01/90] Ensure scrollable element is set with proper direction
---
src/jquery.smooth-scroll.js | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/jquery.smooth-scroll.js b/src/jquery.smooth-scroll.js
index 9b89395..3a078b3 100644
--- a/src/jquery.smooth-scroll.js
+++ b/src/jquery.smooth-scroll.js
@@ -168,9 +168,11 @@ $.smoothScroll = function(options, px) {
if ( opts.scrollElement ) {
$scroller = opts.scrollElement;
- scrollerOffset = $scroller[scrollDir]();
+ if ( !(/^(?:HTML|BODY)$/).test($scroller[0].nodeName) ) {
+ scrollerOffset = $scroller[scrollDir]();
+ }
} else {
- $scroller = $('html, body').firstScrollable();
+ $scroller = $('html, body').firstScrollable(opts.direction);
}
// beforeScroll callback function must fire before calculating offset
@@ -218,7 +220,7 @@ $.smoothScroll.version = version;
$.smoothScroll.filterPath = function(string) {
return string
.replace(/^\//,'')
- .replace(/(index|default).[a-zA-Z]{3,4}$/,'')
+ .replace(/(?:index|default).[a-zA-Z]{3,4}$/,'')
.replace(/\/$/,'');
};
From e915e10901c0e8dbfa793c7093bd0f2961ead8bd Mon Sep 17 00:00:00 2001
From: Karl Swedberg
Date: Thu, 19 Sep 2013 14:51:47 -0400
Subject: [PATCH 02/90] Bumped version and updated dist files
---
bower.json | 2 +-
jquery.smooth-scroll.js | 14 +++++++-------
jquery.smooth-scroll.min.js | 4 ++--
package.json | 2 +-
smooth-scroll.jquery.json | 2 +-
src/jquery.smooth-scroll.js | 3 +--
6 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/bower.json b/bower.json
index cb4b9d2..4f80b4c 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "jquery.smooth-scroll",
- "version": "1.4.11",
+ "version": "1.4.12",
"dependencies": {
"jquery": ">=1.3"
},
diff --git a/jquery.smooth-scroll.js b/jquery.smooth-scroll.js
index fe18d1d..0ba2abc 100644
--- a/jquery.smooth-scroll.js
+++ b/jquery.smooth-scroll.js
@@ -1,13 +1,12 @@
/*!
- * Smooth Scroll - v1.4.11 - 2013-07-15
+ * Smooth Scroll - v1.4.12 - 2013-09-19
* https://github.com/kswedberg/jquery-smooth-scroll
* Copyright (c) 2013 Karl Swedberg
* Licensed MIT (https://github.com/kswedberg/jquery-smooth-scroll/blob/master/LICENSE-MIT)
*/
(function($) {
-
-var version = '1.4.11',
+var version = '1.4.12',
defaults = {
exclude: [],
excludeWithin:[],
@@ -44,7 +43,6 @@ var version = '1.4.11',
var scrollable = [],
scrolled = false,
dir = opts.dir && opts.dir == 'left' ? 'scrollLeft' : 'scrollTop';
-
this.each(function() {
if (this == document || this == window) { return; }
@@ -175,9 +173,11 @@ $.smoothScroll = function(options, px) {
if ( opts.scrollElement ) {
$scroller = opts.scrollElement;
- scrollerOffset = $scroller[scrollDir]();
+ if ( !(/^(?:HTML|BODY)$/).test($scroller[0].nodeName) ) {
+ scrollerOffset = $scroller[scrollDir]();
+ }
} else {
- $scroller = $('html, body').firstScrollable();
+ $scroller = $('html, body').firstScrollable(opts.direction);
}
// beforeScroll callback function must fire before calculating offset
@@ -225,7 +225,7 @@ $.smoothScroll.version = version;
$.smoothScroll.filterPath = function(string) {
return string
.replace(/^\//,'')
- .replace(/(index|default).[a-zA-Z]{3,4}$/,'')
+ .replace(/(?:index|default).[a-zA-Z]{3,4}$/,'')
.replace(/\/$/,'');
};
diff --git a/jquery.smooth-scroll.min.js b/jquery.smooth-scroll.min.js
index 0853d90..d734d41 100644
--- a/jquery.smooth-scroll.min.js
+++ b/jquery.smooth-scroll.min.js
@@ -1,7 +1,7 @@
/*!
- * Smooth Scroll - v1.4.11 - 2013-07-15
+ * Smooth Scroll - v1.4.12 - 2013-09-19
* https://github.com/kswedberg/jquery-smooth-scroll
* Copyright (c) 2013 Karl Swedberg
* Licensed MIT (https://github.com/kswedberg/jquery-smooth-scroll/blob/master/LICENSE-MIT)
*/
-(function(l){function t(l){return l.replace(/(:|\.)/g,"\\$1")}var e="1.4.11",o={exclude:[],excludeWithin:[],offset:0,direction:"top",scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficent:2,preventDefault:!0},r=function(t){var e=[],o=!1,r=t.dir&&"left"==t.dir?"scrollLeft":"scrollTop";return this.each(function(){if(this!=document&&this!=window){var t=l(this);t[r]()>0?e.push(this):(t[r](1),o=t[r]()>0,o&&e.push(this),t[r](0))}}),e.length||this.each(function(){"BODY"===this.nodeName&&(e=[this])}),"first"===t.el&&e.length>1&&(e=[e[0]]),e};l.fn.extend({scrollable:function(l){var t=r.call(this,{dir:l});return this.pushStack(t)},firstScrollable:function(l){var t=r.call(this,{el:"first",dir:l});return this.pushStack(t)},smoothScroll:function(e){e=e||{};var o=l.extend({},l.fn.smoothScroll.defaults,e),r=l.smoothScroll.filterPath(location.pathname);return this.unbind("click.smoothscroll").bind("click.smoothscroll",function(e){var n=this,s=l(this),c=o.exclude,i=o.excludeWithin,a=0,f=0,h=!0,u={},d=location.hostname===n.hostname||!n.hostname,m=o.scrollTarget||(l.smoothScroll.filterPath(n.pathname)||r)===r,p=t(n.hash);if(o.scrollTarget||d&&m&&p){for(;h&&c.length>a;)s.is(t(c[a++]))&&(h=!1);for(;h&&i.length>f;)s.closest(i[f++]).length&&(h=!1)}else h=!1;h&&(o.preventDefault&&e.preventDefault(),l.extend(u,o,{scrollTarget:o.scrollTarget||p,link:n}),l.smoothScroll(u))}),this}}),l.smoothScroll=function(t,e){var o,r,n,s,c=0,i="offset",a="scrollTop",f={},h={};"number"==typeof t?(o=l.fn.smoothScroll.defaults,n=t):(o=l.extend({},l.fn.smoothScroll.defaults,t||{}),o.scrollElement&&(i="position","static"==o.scrollElement.css("position")&&o.scrollElement.css("position","relative"))),o=l.extend({link:null},o),a="left"==o.direction?"scrollLeft":a,o.scrollElement?(r=o.scrollElement,c=r[a]()):r=l("html, body").firstScrollable(),o.beforeScroll.call(r,o),n="number"==typeof t?t:e||l(o.scrollTarget)[i]()&&l(o.scrollTarget)[i]()[o.direction]||0,f[a]=n+c+o.offset,s=o.speed,"auto"===s&&(s=f[a]||r.scrollTop(),s/=o.autoCoefficent),h={duration:s,easing:o.easing,complete:function(){o.afterScroll.call(o.link,o)}},o.step&&(h.step=o.step),r.length?r.stop().animate(f,h):o.afterScroll.call(o.link,o)},l.smoothScroll.version=e,l.smoothScroll.filterPath=function(l){return l.replace(/^\//,"").replace(/(index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},l.fn.smoothScroll.defaults=o})(jQuery);
\ No newline at end of file
+(function(t){function l(t){return t.replace(/(:|\.)/g,"\\$1")}var e="1.4.12",o={exclude:[],excludeWithin:[],offset:0,direction:"top",scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficent:2,preventDefault:!0},n=function(l){var e=[],o=!1,n=l.dir&&"left"==l.dir?"scrollLeft":"scrollTop";return this.each(function(){if(this!=document&&this!=window){var l=t(this);l[n]()>0?e.push(this):(l[n](1),o=l[n]()>0,o&&e.push(this),l[n](0))}}),e.length||this.each(function(){"BODY"===this.nodeName&&(e=[this])}),"first"===l.el&&e.length>1&&(e=[e[0]]),e};t.fn.extend({scrollable:function(t){var l=n.call(this,{dir:t});return this.pushStack(l)},firstScrollable:function(t){var l=n.call(this,{el:"first",dir:t});return this.pushStack(l)},smoothScroll:function(e){e=e||{};var o=t.extend({},t.fn.smoothScroll.defaults,e),n=t.smoothScroll.filterPath(location.pathname);return this.unbind("click.smoothscroll").bind("click.smoothscroll",function(e){var r=this,s=t(this),c=o.exclude,i=o.excludeWithin,a=0,f=0,h=!0,u={},d=location.hostname===r.hostname||!r.hostname,m=o.scrollTarget||(t.smoothScroll.filterPath(r.pathname)||n)===n,p=l(r.hash);if(o.scrollTarget||d&&m&&p){for(;h&&c.length>a;)s.is(l(c[a++]))&&(h=!1);for(;h&&i.length>f;)s.closest(i[f++]).length&&(h=!1)}else h=!1;h&&(o.preventDefault&&e.preventDefault(),t.extend(u,o,{scrollTarget:o.scrollTarget||p,link:r}),t.smoothScroll(u))}),this}}),t.smoothScroll=function(l,e){var o,n,r,s,c=0,i="offset",a="scrollTop",f={},h={};"number"==typeof l?(o=t.fn.smoothScroll.defaults,r=l):(o=t.extend({},t.fn.smoothScroll.defaults,l||{}),o.scrollElement&&(i="position","static"==o.scrollElement.css("position")&&o.scrollElement.css("position","relative"))),o=t.extend({link:null},o),a="left"==o.direction?"scrollLeft":a,o.scrollElement?(n=o.scrollElement,/^(?:HTML|BODY)$/.test(n[0].nodeName)||(c=n[a]())):n=t("html, body").firstScrollable(o.direction),o.beforeScroll.call(n,o),r="number"==typeof l?l:e||t(o.scrollTarget)[i]()&&t(o.scrollTarget)[i]()[o.direction]||0,f[a]=r+c+o.offset,s=o.speed,"auto"===s&&(s=f[a]||n.scrollTop(),s/=o.autoCoefficent),h={duration:s,easing:o.easing,complete:function(){o.afterScroll.call(o.link,o)}},o.step&&(h.step=o.step),n.length?n.stop().animate(f,h):o.afterScroll.call(o.link,o)},t.smoothScroll.version=e,t.smoothScroll.filterPath=function(t){return t.replace(/^\//,"").replace(/(?:index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},t.fn.smoothScroll.defaults=o})(jQuery);
\ No newline at end of file
diff --git a/package.json b/package.json
index be71969..a09204d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "smooth-scroll",
- "version": "1.4.11",
+ "version": "1.4.12",
"scripts": {
"test": "./node_modules/.bin/grunt"
},
diff --git a/smooth-scroll.jquery.json b/smooth-scroll.jquery.json
index c52eac0..2e9731f 100644
--- a/smooth-scroll.jquery.json
+++ b/smooth-scroll.jquery.json
@@ -1,6 +1,6 @@
{
"name": "smooth-scroll",
- "version": "1.4.11",
+ "version": "1.4.12",
"title": "Smooth Scroll",
"description": "Easy implementation of smooth scrolling for same-page links",
"author": {
diff --git a/src/jquery.smooth-scroll.js b/src/jquery.smooth-scroll.js
index 3a078b3..e270ed5 100644
--- a/src/jquery.smooth-scroll.js
+++ b/src/jquery.smooth-scroll.js
@@ -1,6 +1,5 @@
(function($) {
-
-var version = '1.4.11',
+var version = '1.4.12',
defaults = {
exclude: [],
excludeWithin:[],
From 2c246cf7ea36b39aee6bc0f9c71a2ca0e30ae755 Mon Sep 17 00:00:00 2001
From: Karl Swedberg
Date: Fri, 20 Sep 2013 14:11:40 -0400
Subject: [PATCH 03/90] Update bbq demo
---
demo/bbq.html | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/demo/bbq.html b/demo/bbq.html
index 7218194..f668b79 100644
--- a/demo/bbq.html
+++ b/demo/bbq.html
@@ -25,7 +25,9 @@ Smooth Scroll jQuery Plugin with Back Button Support
p3
p4
p5
+ index.html#p5 (goes to new page)
#
+
not-here
p1 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
@@ -48,7 +50,7 @@ Smooth Scroll jQuery Plugin with Back Button Support
+
@@ -41,6 +41,14 @@
});
});
+ $('#change-speed').on('click', function() {
+ var $p1 = $('ul.mainnav a').first(),
+ p1Opts = $p1.smoothScroll('options') || {};
+
+ p1Opts.speed = p1Opts.speed === 1400 ? 400 : 1400;
+ $p1.smoothScroll('options', p1Opts);
+ });
+
$('button.scrollsomething').click(function() {
$.smoothScroll({
scrollElement: $('div.scrollme'),
@@ -73,6 +81,7 @@
bbq.html#p5
Or, try it with hashchange support
+ Toggle scrolling speed for the p1 link Change speed option
Scroll vertically
Scroll horizontally
diff --git a/src/jquery.smooth-scroll.js b/src/jquery.smooth-scroll.js
index e270ed5..df6b19d 100644
--- a/src/jquery.smooth-scroll.js
+++ b/src/jquery.smooth-scroll.js
@@ -1,5 +1,6 @@
(function($) {
var version = '1.4.12',
+ optionOverrides = {},
defaults = {
exclude: [],
excludeWithin:[],
@@ -86,8 +87,21 @@ $.fn.extend({
return this.pushStack(scrl);
},
- smoothScroll: function(options) {
+ smoothScroll: function(options, extra) {
options = options || {};
+
+ if ( options === 'options' ) {
+ if ( !extra ) {
+ return this.first().data('ssOpts');
+ }
+ return this.each(function() {
+ var $this = $(this),
+ opts = $.extend($this.data('ssOpts') || {}, extra);
+
+ $(this).data('ssOpts', opts);
+ });
+ }
+
var opts = $.extend({}, $.fn.smoothScroll.defaults, options),
locationPath = $.smoothScroll.filterPath(location.pathname);
@@ -96,16 +110,17 @@ $.fn.extend({
.bind('click.smoothscroll', function(event) {
var link = this,
$link = $(this),
+ thisOpts = $.extend({}, opts, $link.data('ssOpts') || {}),
exclude = opts.exclude,
- excludeWithin = opts.excludeWithin,
+ excludeWithin = thisOpts.excludeWithin,
elCounter = 0, ewlCounter = 0,
include = true,
clickOpts = {},
hostMatch = ((location.hostname === link.hostname) || !link.hostname),
- pathMatch = opts.scrollTarget || ( $.smoothScroll.filterPath(link.pathname) || locationPath ) === locationPath,
+ pathMatch = thisOpts.scrollTarget || ( $.smoothScroll.filterPath(link.pathname) || locationPath ) === locationPath,
thisHash = escapeSelector(link.hash);
- if ( !opts.scrollTarget && (!hostMatch || !pathMatch || !thisHash) ) {
+ if ( !thisOpts.scrollTarget && (!hostMatch || !pathMatch || !thisHash) ) {
include = false;
} else {
while (include && elCounter < exclude.length) {
@@ -122,15 +137,14 @@ $.fn.extend({
if ( include ) {
- if ( opts.preventDefault ) {
+ if ( thisOpts.preventDefault ) {
event.preventDefault();
}
- $.extend( clickOpts, opts, {
- scrollTarget: opts.scrollTarget || thisHash,
+ $.extend( clickOpts, thisOpts, {
+ scrollTarget: thisOpts.scrollTarget || thisHash,
link: link
});
-
$.smoothScroll( clickOpts );
}
});
@@ -140,6 +154,9 @@ $.fn.extend({
});
$.smoothScroll = function(options, px) {
+ if ( options === 'options' && typeof px === 'object' ) {
+ return $.extend(optionOverrides, px);
+ }
var opts, $scroller, scrollTargetOffset, speed,
scrollerOffset = 0,
offPos = 'offset',
@@ -148,12 +165,11 @@ $.smoothScroll = function(options, px) {
aniOpts = {},
scrollprops = [];
-
if (typeof options === 'number') {
- opts = $.fn.smoothScroll.defaults;
+ opts = $.extend({link: null}, $.fn.smoothScroll.defaults, optionOverrides);
scrollTargetOffset = options;
} else {
- opts = $.extend({}, $.fn.smoothScroll.defaults, options || {});
+ opts = $.extend({link: null}, $.fn.smoothScroll.defaults, options || {}, optionOverrides);
if (opts.scrollElement) {
offPos = 'position';
if (opts.scrollElement.css('position') == 'static') {
@@ -162,7 +178,6 @@ $.smoothScroll = function(options, px) {
}
}
- opts = $.extend({link: null}, opts);
scrollDir = opts.direction == 'left' ? 'scrollLeft' : scrollDir;
if ( opts.scrollElement ) {
From ffdc2200f41cc02b38f0434a98676d0f97972137 Mon Sep 17 00:00:00 2001
From: Karl Swedberg
Date: Sat, 2 Nov 2013 18:13:15 -0400
Subject: [PATCH 05/90] Build files and bump version
---
Gruntfile.js | 4 +++-
bower.json | 2 +-
jquery.smooth-scroll.js | 44 +++++++++++++++++++++++++------------
jquery.smooth-scroll.min.js | 4 ++--
package.json | 2 +-
smooth-scroll.jquery.json | 2 +-
src/jquery.smooth-scroll.js | 2 +-
7 files changed, 39 insertions(+), 21 deletions(-)
diff --git a/Gruntfile.js b/Gruntfile.js
index 4999080..08b18d3 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -67,7 +67,9 @@ module.exports = function(grunt) {
shell: {
rsync: {
// command is set by setshell:rsync.
- stdout: true
+ options: {
+ stdout: true
+ }
}
},
setshell: {
diff --git a/bower.json b/bower.json
index 4f80b4c..ab25067 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "jquery.smooth-scroll",
- "version": "1.4.12",
+ "version": "1.4.13",
"dependencies": {
"jquery": ">=1.3"
},
diff --git a/jquery.smooth-scroll.js b/jquery.smooth-scroll.js
index 0ba2abc..7d527c3 100644
--- a/jquery.smooth-scroll.js
+++ b/jquery.smooth-scroll.js
@@ -1,12 +1,13 @@
/*!
- * Smooth Scroll - v1.4.12 - 2013-09-19
+ * Smooth Scroll - v1.4.13 - 2013-11-02
* https://github.com/kswedberg/jquery-smooth-scroll
* Copyright (c) 2013 Karl Swedberg
* Licensed MIT (https://github.com/kswedberg/jquery-smooth-scroll/blob/master/LICENSE-MIT)
*/
(function($) {
-var version = '1.4.12',
+var version = '1.4.13',
+ optionOverrides = {},
defaults = {
exclude: [],
excludeWithin:[],
@@ -43,6 +44,7 @@ var version = '1.4.12',
var scrollable = [],
scrolled = false,
dir = opts.dir && opts.dir == 'left' ? 'scrollLeft' : 'scrollTop';
+
this.each(function() {
if (this == document || this == window) { return; }
@@ -92,8 +94,21 @@ $.fn.extend({
return this.pushStack(scrl);
},
- smoothScroll: function(options) {
+ smoothScroll: function(options, extra) {
options = options || {};
+
+ if ( options === 'options' ) {
+ if ( !extra ) {
+ return this.first().data('ssOpts');
+ }
+ return this.each(function() {
+ var $this = $(this),
+ opts = $.extend($this.data('ssOpts') || {}, extra);
+
+ $(this).data('ssOpts', opts);
+ });
+ }
+
var opts = $.extend({}, $.fn.smoothScroll.defaults, options),
locationPath = $.smoothScroll.filterPath(location.pathname);
@@ -102,16 +117,17 @@ $.fn.extend({
.bind('click.smoothscroll', function(event) {
var link = this,
$link = $(this),
+ thisOpts = $.extend({}, opts, $link.data('ssOpts') || {}),
exclude = opts.exclude,
- excludeWithin = opts.excludeWithin,
+ excludeWithin = thisOpts.excludeWithin,
elCounter = 0, ewlCounter = 0,
include = true,
clickOpts = {},
hostMatch = ((location.hostname === link.hostname) || !link.hostname),
- pathMatch = opts.scrollTarget || ( $.smoothScroll.filterPath(link.pathname) || locationPath ) === locationPath,
+ pathMatch = thisOpts.scrollTarget || ( $.smoothScroll.filterPath(link.pathname) || locationPath ) === locationPath,
thisHash = escapeSelector(link.hash);
- if ( !opts.scrollTarget && (!hostMatch || !pathMatch || !thisHash) ) {
+ if ( !thisOpts.scrollTarget && (!hostMatch || !pathMatch || !thisHash) ) {
include = false;
} else {
while (include && elCounter < exclude.length) {
@@ -128,15 +144,14 @@ $.fn.extend({
if ( include ) {
- if ( opts.preventDefault ) {
+ if ( thisOpts.preventDefault ) {
event.preventDefault();
}
- $.extend( clickOpts, opts, {
- scrollTarget: opts.scrollTarget || thisHash,
+ $.extend( clickOpts, thisOpts, {
+ scrollTarget: thisOpts.scrollTarget || thisHash,
link: link
});
-
$.smoothScroll( clickOpts );
}
});
@@ -146,6 +161,9 @@ $.fn.extend({
});
$.smoothScroll = function(options, px) {
+ if ( options === 'options' && typeof px === 'object' ) {
+ return $.extend(optionOverrides, px);
+ }
var opts, $scroller, scrollTargetOffset, speed,
scrollerOffset = 0,
offPos = 'offset',
@@ -154,12 +172,11 @@ $.smoothScroll = function(options, px) {
aniOpts = {},
scrollprops = [];
-
if (typeof options === 'number') {
- opts = $.fn.smoothScroll.defaults;
+ opts = $.extend({link: null}, $.fn.smoothScroll.defaults, optionOverrides);
scrollTargetOffset = options;
} else {
- opts = $.extend({}, $.fn.smoothScroll.defaults, options || {});
+ opts = $.extend({link: null}, $.fn.smoothScroll.defaults, options || {}, optionOverrides);
if (opts.scrollElement) {
offPos = 'position';
if (opts.scrollElement.css('position') == 'static') {
@@ -168,7 +185,6 @@ $.smoothScroll = function(options, px) {
}
}
- opts = $.extend({link: null}, opts);
scrollDir = opts.direction == 'left' ? 'scrollLeft' : scrollDir;
if ( opts.scrollElement ) {
diff --git a/jquery.smooth-scroll.min.js b/jquery.smooth-scroll.min.js
index d734d41..e0cf64a 100644
--- a/jquery.smooth-scroll.min.js
+++ b/jquery.smooth-scroll.min.js
@@ -1,7 +1,7 @@
/*!
- * Smooth Scroll - v1.4.12 - 2013-09-19
+ * Smooth Scroll - v1.4.13 - 2013-11-02
* https://github.com/kswedberg/jquery-smooth-scroll
* Copyright (c) 2013 Karl Swedberg
* Licensed MIT (https://github.com/kswedberg/jquery-smooth-scroll/blob/master/LICENSE-MIT)
*/
-(function(t){function l(t){return t.replace(/(:|\.)/g,"\\$1")}var e="1.4.12",o={exclude:[],excludeWithin:[],offset:0,direction:"top",scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficent:2,preventDefault:!0},n=function(l){var e=[],o=!1,n=l.dir&&"left"==l.dir?"scrollLeft":"scrollTop";return this.each(function(){if(this!=document&&this!=window){var l=t(this);l[n]()>0?e.push(this):(l[n](1),o=l[n]()>0,o&&e.push(this),l[n](0))}}),e.length||this.each(function(){"BODY"===this.nodeName&&(e=[this])}),"first"===l.el&&e.length>1&&(e=[e[0]]),e};t.fn.extend({scrollable:function(t){var l=n.call(this,{dir:t});return this.pushStack(l)},firstScrollable:function(t){var l=n.call(this,{el:"first",dir:t});return this.pushStack(l)},smoothScroll:function(e){e=e||{};var o=t.extend({},t.fn.smoothScroll.defaults,e),n=t.smoothScroll.filterPath(location.pathname);return this.unbind("click.smoothscroll").bind("click.smoothscroll",function(e){var r=this,s=t(this),c=o.exclude,i=o.excludeWithin,a=0,f=0,h=!0,u={},d=location.hostname===r.hostname||!r.hostname,m=o.scrollTarget||(t.smoothScroll.filterPath(r.pathname)||n)===n,p=l(r.hash);if(o.scrollTarget||d&&m&&p){for(;h&&c.length>a;)s.is(l(c[a++]))&&(h=!1);for(;h&&i.length>f;)s.closest(i[f++]).length&&(h=!1)}else h=!1;h&&(o.preventDefault&&e.preventDefault(),t.extend(u,o,{scrollTarget:o.scrollTarget||p,link:r}),t.smoothScroll(u))}),this}}),t.smoothScroll=function(l,e){var o,n,r,s,c=0,i="offset",a="scrollTop",f={},h={};"number"==typeof l?(o=t.fn.smoothScroll.defaults,r=l):(o=t.extend({},t.fn.smoothScroll.defaults,l||{}),o.scrollElement&&(i="position","static"==o.scrollElement.css("position")&&o.scrollElement.css("position","relative"))),o=t.extend({link:null},o),a="left"==o.direction?"scrollLeft":a,o.scrollElement?(n=o.scrollElement,/^(?:HTML|BODY)$/.test(n[0].nodeName)||(c=n[a]())):n=t("html, body").firstScrollable(o.direction),o.beforeScroll.call(n,o),r="number"==typeof l?l:e||t(o.scrollTarget)[i]()&&t(o.scrollTarget)[i]()[o.direction]||0,f[a]=r+c+o.offset,s=o.speed,"auto"===s&&(s=f[a]||n.scrollTop(),s/=o.autoCoefficent),h={duration:s,easing:o.easing,complete:function(){o.afterScroll.call(o.link,o)}},o.step&&(h.step=o.step),n.length?n.stop().animate(f,h):o.afterScroll.call(o.link,o)},t.smoothScroll.version=e,t.smoothScroll.filterPath=function(t){return t.replace(/^\//,"").replace(/(?:index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},t.fn.smoothScroll.defaults=o})(jQuery);
\ No newline at end of file
+(function(t){function e(t){return t.replace(/(:|\.)/g,"\\$1")}var l="1.4.13",o={},s={exclude:[],excludeWithin:[],offset:0,direction:"top",scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficent:2,preventDefault:!0},n=function(e){var l=[],o=!1,s=e.dir&&"left"==e.dir?"scrollLeft":"scrollTop";return this.each(function(){if(this!=document&&this!=window){var e=t(this);e[s]()>0?l.push(this):(e[s](1),o=e[s]()>0,o&&l.push(this),e[s](0))}}),l.length||this.each(function(){"BODY"===this.nodeName&&(l=[this])}),"first"===e.el&&l.length>1&&(l=[l[0]]),l};t.fn.extend({scrollable:function(t){var e=n.call(this,{dir:t});return this.pushStack(e)},firstScrollable:function(t){var e=n.call(this,{el:"first",dir:t});return this.pushStack(e)},smoothScroll:function(l,o){if(l=l||{},"options"===l)return o?this.each(function(){var e=t(this),l=t.extend(e.data("ssOpts")||{},o);t(this).data("ssOpts",l)}):this.first().data("ssOpts");var s=t.extend({},t.fn.smoothScroll.defaults,l),n=t.smoothScroll.filterPath(location.pathname);return this.unbind("click.smoothscroll").bind("click.smoothscroll",function(l){var o=this,r=t(this),i=t.extend({},s,r.data("ssOpts")||{}),c=s.exclude,a=i.excludeWithin,f=0,h=0,u=!0,d={},p=location.hostname===o.hostname||!o.hostname,m=i.scrollTarget||(t.smoothScroll.filterPath(o.pathname)||n)===n,S=e(o.hash);if(i.scrollTarget||p&&m&&S){for(;u&&c.length>f;)r.is(e(c[f++]))&&(u=!1);for(;u&&a.length>h;)r.closest(a[h++]).length&&(u=!1)}else u=!1;u&&(i.preventDefault&&l.preventDefault(),t.extend(d,i,{scrollTarget:i.scrollTarget||S,link:o}),t.smoothScroll(d))}),this}}),t.smoothScroll=function(e,l){if("options"===e&&"object"==typeof l)return t.extend(o,l);var s,n,r,i,c=0,a="offset",f="scrollTop",h={},u={};"number"==typeof e?(s=t.extend({link:null},t.fn.smoothScroll.defaults,o),r=e):(s=t.extend({link:null},t.fn.smoothScroll.defaults,e||{},o),s.scrollElement&&(a="position","static"==s.scrollElement.css("position")&&s.scrollElement.css("position","relative"))),f="left"==s.direction?"scrollLeft":f,s.scrollElement?(n=s.scrollElement,/^(?:HTML|BODY)$/.test(n[0].nodeName)||(c=n[f]())):n=t("html, body").firstScrollable(s.direction),s.beforeScroll.call(n,s),r="number"==typeof e?e:l||t(s.scrollTarget)[a]()&&t(s.scrollTarget)[a]()[s.direction]||0,h[f]=r+c+s.offset,i=s.speed,"auto"===i&&(i=h[f]||n.scrollTop(),i/=s.autoCoefficent),u={duration:i,easing:s.easing,complete:function(){s.afterScroll.call(s.link,s)}},s.step&&(u.step=s.step),n.length?n.stop().animate(h,u):s.afterScroll.call(s.link,s)},t.smoothScroll.version=l,t.smoothScroll.filterPath=function(t){return t.replace(/^\//,"").replace(/(?:index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},t.fn.smoothScroll.defaults=s})(jQuery);
\ No newline at end of file
diff --git a/package.json b/package.json
index a09204d..c0aafbf 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "smooth-scroll",
- "version": "1.4.12",
+ "version": "1.4.13",
"scripts": {
"test": "./node_modules/.bin/grunt"
},
diff --git a/smooth-scroll.jquery.json b/smooth-scroll.jquery.json
index 2e9731f..723226c 100644
--- a/smooth-scroll.jquery.json
+++ b/smooth-scroll.jquery.json
@@ -1,6 +1,6 @@
{
"name": "smooth-scroll",
- "version": "1.4.12",
+ "version": "1.4.13",
"title": "Smooth Scroll",
"description": "Easy implementation of smooth scrolling for same-page links",
"author": {
diff --git a/src/jquery.smooth-scroll.js b/src/jquery.smooth-scroll.js
index df6b19d..b8965c9 100644
--- a/src/jquery.smooth-scroll.js
+++ b/src/jquery.smooth-scroll.js
@@ -1,5 +1,5 @@
(function($) {
-var version = '1.4.12',
+var version = '1.4.13',
optionOverrides = {},
defaults = {
exclude: [],
From 037a27be10df3d862a8c42cbba1a72a20ae57626 Mon Sep 17 00:00:00 2001
From: Karl Swedberg
Date: Fri, 21 Feb 2014 21:49:00 -0500
Subject: [PATCH 06/90] Update jquery.js
---
demo/bbq-fixed.html | 3 +-
demo/bbq.html | 3 +-
demo/fixed-fix.html | 4 +-
demo/fixed.html | 4 +-
demo/index.html | 3 +-
lib/jquery/jquery.js | 14251 ++++++++++++++++++++++-------------------
6 files changed, 7597 insertions(+), 6671 deletions(-)
diff --git a/demo/bbq-fixed.html b/demo/bbq-fixed.html
index 4a657e3..2bb41b1 100644
--- a/demo/bbq-fixed.html
+++ b/demo/bbq-fixed.html
@@ -46,8 +46,7 @@ Smooth Scroll jQuery Plugin with Back Button Support
-
-
+
-
+
-
-
+
-
-
+
-
+
+
+
+
+