1
- $ ( function ( ) {
2
- $ ( '#hook' ) . hook ( ) ;
3
- } ) ;
1
+ /**
2
+ * Hook
3
+ * Version: 1.1
4
+ * Author: Jordan Singer, Brandon Jacoby, Adam Girton
5
+ * Copyright (c) 2013 - Hook. All rights reserved.
6
+ * http://www.usehook.com
7
+ */
4
8
5
9
; ( function ( $ , window , document , undefined ) {
6
10
var win = $ ( this ) ,
@@ -19,9 +23,8 @@ $(function () {
19
23
return this . each ( function ( ) {
20
24
var $this = $ ( this ) ,
21
25
settings = $this . data ( 'hook' ) ;
22
- height = $this . height ( ) ;
23
26
24
- if ( typeof ( settings ) == 'undefined' ) {
27
+ if ( typeof ( settings ) === 'undefined' ) {
25
28
26
29
var defaults = {
27
30
reloadPage : true , // if false will reload element
@@ -80,7 +83,9 @@ $(function () {
80
83
swipe = e . originalEvent . touches [ 0 ] . pageY + lastY ;
81
84
st = $ ( this ) . scrollTop ( ) ;
82
85
83
- if ( swipe < settings . swipeDistance ) e . preventDefault ( ) ;
86
+ if ( swipe < settings . swipeDistance ) {
87
+ e . preventDefault ( ) ;
88
+ }
84
89
85
90
if ( swipe > settings . swipeDistance && lastY <= 40 ) {
86
91
methods . onSwipe ( $this , settings ) ;
@@ -113,15 +118,13 @@ $(function () {
113
118
}
114
119
} ,
115
120
116
- onSwipe : function ( el , settings , swipe ) {
121
+ onSwipe : function ( el , settings ) {
117
122
if ( st <= 0 ) {
118
123
methods . reload ( el , settings ) ;
119
124
}
120
125
} ,
121
126
122
127
reload : function ( el , settings ) {
123
- var reloadEvent ;
124
-
125
128
el . show ( ) ;
126
129
el . animate ( {
127
130
"marginTop" : "0px"
@@ -139,7 +142,7 @@ $(function () {
139
142
}
140
143
} ,
141
144
142
- destroy : function ( options ) {
145
+ destroy : function ( ) {
143
146
return $ ( this ) . each ( function ( ) {
144
147
var $this = $ ( this ) ;
145
148
@@ -149,13 +152,13 @@ $(function () {
149
152
}
150
153
} ;
151
154
152
- $ . fn . hook = function ( options ) {
155
+ $ . fn . hook = function ( ) {
153
156
var method = arguments [ 0 ] ;
154
157
155
158
if ( methods [ method ] ) {
156
159
method = methods [ method ] ;
157
160
arguments = Array . prototype . slice . call ( arguments , 1 ) ;
158
- } else if ( typeof ( method ) == 'object' || ! method ) {
161
+ } else if ( typeof ( method ) === 'object' || ! method ) {
159
162
method = methods . init ;
160
163
} else {
161
164
$ . error ( 'Method ' + method + ' does not exist on jQuery.pluginName' ) ;
0 commit comments