1
1
/*!
2
2
* jQuery Smooth Scroll Plugin v1.4.1
3
3
*
4
- * Date: Thu Oct 20 17:05:46 2011 EDT
4
+ * Date: Tue Nov 15 14:24:14 2011 EST
5
5
* Requires: jQuery v1.3+
6
6
*
7
7
* Copyright 2010, Karl Swedberg
@@ -77,18 +77,18 @@ $.fn.extend({
77
77
var opts = $ . extend ( { } , $ . fn . smoothScroll . defaults , options ) ;
78
78
this . die ( 'click.smoothscroll' ) . live ( 'click.smoothscroll' , function ( event ) {
79
79
80
- var link = this , $link = $ ( this ) ,
80
+ var clickOpts = { } , link = this , $link = $ ( this ) ,
81
81
hostMatch = ( ( location . hostname === link . hostname ) || ! link . hostname ) ,
82
82
pathMatch = opts . scrollTarget || ( filterPath ( link . pathname ) || locationPath ) === locationPath ,
83
- thisHash = escape_selector ( link . hash ) ,
83
+ thisHash = escapeSelector ( link . hash ) ,
84
84
include = true ;
85
85
86
86
if ( ! opts . scrollTarget && ( ! hostMatch || ! pathMatch || ! thisHash ) ) {
87
87
include = false ;
88
88
} else {
89
89
var exclude = opts . exclude , elCounter = 0 , el = exclude . length ;
90
90
while ( include && elCounter < el ) {
91
- if ( $link . is ( escape_selector ( exclude [ elCounter ++ ] ) ) ) {
91
+ if ( $link . is ( escapeSelector ( exclude [ elCounter ++ ] ) ) ) {
92
92
include = false ;
93
93
}
94
94
}
@@ -102,17 +102,20 @@ $.fn.extend({
102
102
}
103
103
104
104
if ( include ) {
105
- opts . scrollTarget = options . scrollTarget || thisHash ;
106
- opts . link = link ;
107
105
event . preventDefault ( ) ;
108
- $ . smoothScroll ( opts ) ;
106
+
107
+ $ . extend ( clickOpts , opts , {
108
+ scrollTarget : opts . scrollTarget || thisHash ,
109
+ link : link
110
+ } ) ;
111
+
112
+ $ . smoothScroll ( clickOpts ) ;
109
113
}
110
114
} ) ;
111
115
112
116
return this ;
113
117
114
118
}
115
-
116
119
} ) ;
117
120
118
121
$ . smoothScroll = function ( options , px ) {
@@ -182,7 +185,7 @@ function filterPath(string) {
182
185
. replace ( / \/ $ / , '' ) ;
183
186
}
184
187
185
- function escape_selector ( str ) {
188
+ function escapeSelector ( str ) {
186
189
return str . replace ( / ( : | \. ) / g, '\\$1' ) ;
187
190
}
188
191
0 commit comments