11/*!
22 * jQuery Smooth Scroll Plugin v1.4.1
33 *
4- * Date: Thu Oct 20 17:05:46 2011 EDT
4+ * Date: Tue Nov 15 14:24:14 2011 EST
55 * Requires: jQuery v1.3+
66 *
77 * Copyright 2010, Karl Swedberg
@@ -77,18 +77,18 @@ $.fn.extend({
7777 var opts = $ . extend ( { } , $ . fn . smoothScroll . defaults , options ) ;
7878 this . die ( 'click.smoothscroll' ) . live ( 'click.smoothscroll' , function ( event ) {
7979
80- var link = this , $link = $ ( this ) ,
80+ var clickOpts = { } , link = this , $link = $ ( this ) ,
8181 hostMatch = ( ( location . hostname === link . hostname ) || ! link . hostname ) ,
8282 pathMatch = opts . scrollTarget || ( filterPath ( link . pathname ) || locationPath ) === locationPath ,
83- thisHash = escape_selector ( link . hash ) ,
83+ thisHash = escapeSelector ( link . hash ) ,
8484 include = true ;
8585
8686 if ( ! opts . scrollTarget && ( ! hostMatch || ! pathMatch || ! thisHash ) ) {
8787 include = false ;
8888 } else {
8989 var exclude = opts . exclude , elCounter = 0 , el = exclude . length ;
9090 while ( include && elCounter < el ) {
91- if ( $link . is ( escape_selector ( exclude [ elCounter ++ ] ) ) ) {
91+ if ( $link . is ( escapeSelector ( exclude [ elCounter ++ ] ) ) ) {
9292 include = false ;
9393 }
9494 }
@@ -102,17 +102,20 @@ $.fn.extend({
102102 }
103103
104104 if ( include ) {
105- opts . scrollTarget = options . scrollTarget || thisHash ;
106- opts . link = link ;
107105 event . preventDefault ( ) ;
108- $ . smoothScroll ( opts ) ;
106+
107+ $ . extend ( clickOpts , opts , {
108+ scrollTarget : opts . scrollTarget || thisHash ,
109+ link : link
110+ } ) ;
111+
112+ $ . smoothScroll ( clickOpts ) ;
109113 }
110114 } ) ;
111115
112116 return this ;
113117
114118 }
115-
116119} ) ;
117120
118121$ . smoothScroll = function ( options , px ) {
@@ -182,7 +185,7 @@ function filterPath(string) {
182185 . replace ( / \/ $ / , '' ) ;
183186}
184187
185- function escape_selector ( str ) {
188+ function escapeSelector ( str ) {
186189 return str . replace ( / ( : | \. ) / g, '\\$1' ) ;
187190}
188191
0 commit comments