Skip to content

Commit ffdc220

Browse files
committed
Build files and bump version
1 parent 2da2bf3 commit ffdc220

File tree

7 files changed

+39
-21
lines changed

7 files changed

+39
-21
lines changed

Gruntfile.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ module.exports = function(grunt) {
6767
shell: {
6868
rsync: {
6969
// command is set by setshell:rsync.
70-
stdout: true
70+
options: {
71+
stdout: true
72+
}
7173
}
7274
},
7375
setshell: {

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery.smooth-scroll",
3-
"version": "1.4.12",
3+
"version": "1.4.13",
44
"dependencies": {
55
"jquery": ">=1.3"
66
},

jquery.smooth-scroll.js

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/*!
2-
* Smooth Scroll - v1.4.12 - 2013-09-19
2+
* Smooth Scroll - v1.4.13 - 2013-11-02
33
* https://github.com/kswedberg/jquery-smooth-scroll
44
* Copyright (c) 2013 Karl Swedberg
55
* Licensed MIT (https://github.com/kswedberg/jquery-smooth-scroll/blob/master/LICENSE-MIT)
66
*/
77

88
(function($) {
9-
var version = '1.4.12',
9+
var version = '1.4.13',
10+
optionOverrides = {},
1011
defaults = {
1112
exclude: [],
1213
excludeWithin:[],
@@ -43,6 +44,7 @@ var version = '1.4.12',
4344
var scrollable = [],
4445
scrolled = false,
4546
dir = opts.dir && opts.dir == 'left' ? 'scrollLeft' : 'scrollTop';
47+
4648
this.each(function() {
4749

4850
if (this == document || this == window) { return; }
@@ -92,8 +94,21 @@ $.fn.extend({
9294
return this.pushStack(scrl);
9395
},
9496

95-
smoothScroll: function(options) {
97+
smoothScroll: function(options, extra) {
9698
options = options || {};
99+
100+
if ( options === 'options' ) {
101+
if ( !extra ) {
102+
return this.first().data('ssOpts');
103+
}
104+
return this.each(function() {
105+
var $this = $(this),
106+
opts = $.extend($this.data('ssOpts') || {}, extra);
107+
108+
$(this).data('ssOpts', opts);
109+
});
110+
}
111+
97112
var opts = $.extend({}, $.fn.smoothScroll.defaults, options),
98113
locationPath = $.smoothScroll.filterPath(location.pathname);
99114

@@ -102,16 +117,17 @@ $.fn.extend({
102117
.bind('click.smoothscroll', function(event) {
103118
var link = this,
104119
$link = $(this),
120+
thisOpts = $.extend({}, opts, $link.data('ssOpts') || {}),
105121
exclude = opts.exclude,
106-
excludeWithin = opts.excludeWithin,
122+
excludeWithin = thisOpts.excludeWithin,
107123
elCounter = 0, ewlCounter = 0,
108124
include = true,
109125
clickOpts = {},
110126
hostMatch = ((location.hostname === link.hostname) || !link.hostname),
111-
pathMatch = opts.scrollTarget || ( $.smoothScroll.filterPath(link.pathname) || locationPath ) === locationPath,
127+
pathMatch = thisOpts.scrollTarget || ( $.smoothScroll.filterPath(link.pathname) || locationPath ) === locationPath,
112128
thisHash = escapeSelector(link.hash);
113129

114-
if ( !opts.scrollTarget && (!hostMatch || !pathMatch || !thisHash) ) {
130+
if ( !thisOpts.scrollTarget && (!hostMatch || !pathMatch || !thisHash) ) {
115131
include = false;
116132
} else {
117133
while (include && elCounter < exclude.length) {
@@ -128,15 +144,14 @@ $.fn.extend({
128144

129145
if ( include ) {
130146

131-
if ( opts.preventDefault ) {
147+
if ( thisOpts.preventDefault ) {
132148
event.preventDefault();
133149
}
134150

135-
$.extend( clickOpts, opts, {
136-
scrollTarget: opts.scrollTarget || thisHash,
151+
$.extend( clickOpts, thisOpts, {
152+
scrollTarget: thisOpts.scrollTarget || thisHash,
137153
link: link
138154
});
139-
140155
$.smoothScroll( clickOpts );
141156
}
142157
});
@@ -146,6 +161,9 @@ $.fn.extend({
146161
});
147162

148163
$.smoothScroll = function(options, px) {
164+
if ( options === 'options' && typeof px === 'object' ) {
165+
return $.extend(optionOverrides, px);
166+
}
149167
var opts, $scroller, scrollTargetOffset, speed,
150168
scrollerOffset = 0,
151169
offPos = 'offset',
@@ -154,12 +172,11 @@ $.smoothScroll = function(options, px) {
154172
aniOpts = {},
155173
scrollprops = [];
156174

157-
158175
if (typeof options === 'number') {
159-
opts = $.fn.smoothScroll.defaults;
176+
opts = $.extend({link: null}, $.fn.smoothScroll.defaults, optionOverrides);
160177
scrollTargetOffset = options;
161178
} else {
162-
opts = $.extend({}, $.fn.smoothScroll.defaults, options || {});
179+
opts = $.extend({link: null}, $.fn.smoothScroll.defaults, options || {}, optionOverrides);
163180
if (opts.scrollElement) {
164181
offPos = 'position';
165182
if (opts.scrollElement.css('position') == 'static') {
@@ -168,7 +185,6 @@ $.smoothScroll = function(options, px) {
168185
}
169186
}
170187

171-
opts = $.extend({link: null}, opts);
172188
scrollDir = opts.direction == 'left' ? 'scrollLeft' : scrollDir;
173189

174190
if ( opts.scrollElement ) {

jquery.smooth-scroll.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "smooth-scroll",
3-
"version": "1.4.12",
3+
"version": "1.4.13",
44
"scripts": {
55
"test": "./node_modules/.bin/grunt"
66
},

smooth-scroll.jquery.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "smooth-scroll",
3-
"version": "1.4.12",
3+
"version": "1.4.13",
44
"title": "Smooth Scroll",
55
"description": "Easy implementation of smooth scrolling for same-page links",
66
"author": {

src/jquery.smooth-scroll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(function($) {
2-
var version = '1.4.12',
2+
var version = '1.4.13',
33
optionOverrides = {},
44
defaults = {
55
exclude: [],

0 commit comments

Comments
 (0)