File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,19 @@ define([
17
17
stickyClass : '_sticky'
18
18
} ,
19
19
20
+ /**
21
+ * Retrieve option value
22
+ * @param {String } option
23
+ * @return {* }
24
+ * @private
25
+ */
20
26
_getOptionValue : function ( option ) {
21
27
var value = this . options [ option ] || 0 ;
28
+
22
29
if ( typeof value === 'function' ) {
23
30
value = this . options [ option ] ( ) ;
24
31
}
32
+
25
33
return value ;
26
34
} ,
27
35
@@ -46,7 +54,9 @@ define([
46
54
*/
47
55
_stick : function ( ) {
48
56
var offset ,
49
- isStatic ;
57
+ isStatic ,
58
+ stuck ,
59
+ offsetTop ;
50
60
51
61
isStatic = this . element . css ( 'position' ) === 'static' ;
52
62
@@ -57,14 +67,15 @@ define([
57
67
58
68
offset = Math . max ( 0 , Math . min ( offset , this . maxOffset ) ) ;
59
69
60
- var stuck = this . element . hasClass ( this . options . stickyClass ) ,
61
- offsetTop = this . _getOptionValue ( 'offsetTop' ) ;
70
+ stuck = this . element . hasClass ( this . options . stickyClass ) ;
71
+ offsetTop = this . _getOptionValue ( 'offsetTop' ) ;
72
+
62
73
if ( offset && ! stuck && offset < offsetTop ) {
63
74
offset = 0 ;
64
75
}
65
76
66
77
this . element
67
- . toggleClass ( this . options . stickyClass , ( offset > 0 ) )
78
+ . toggleClass ( this . options . stickyClass , offset > 0 )
68
79
. css ( 'top' , offset ) ;
69
80
}
70
81
} ,
You can’t perform that action at this time.
0 commit comments