Skip to content

Commit 5ab3b72

Browse files
committed
Merge pull request #12 from crowtherdr/master
Made _this a var instead of a global.
2 parents c8dd638 + 17491c3 commit 5ab3b72

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/.jshintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
"eqnull": true,
1313
"browser": true,
1414
"predef": ["jQuery"],
15-
"unused": "vars"
15+
"unused": "vars",
16+
"strict": true
1617
}

src/dragpan.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
/* global $: false */
2+
3+
(function () {
4+
"use strict";
5+
var _this;
6+
17
/*jshint -W117 */
28
$.widget( "oml.dragpan", {
3-
9+
410
// The widget default options
511
_defaults: {
612
speedX: 10, // X Speed default is 10
@@ -30,7 +36,7 @@ $.widget( "oml.dragpan", {
3036
}
3137

3238
// Set up the variables used in the function
33-
39+
3440
// Set up child and parent elements
3541
_this.vars.$parent = _this.options.$parent;
3642
_this.vars.$child = _this.vars.$parent.children();
@@ -100,7 +106,7 @@ $.widget( "oml.dragpan", {
100106
}
101107
},
102108
_updateScrollPosition: function (x, y, relational) {
103-
// If the new scroll position is in relation to the old ones
109+
// If the new scroll position is in relation to the old ones
104110
// then update the scroll position based on them
105111
if ( relational === true ) {
106112
_this.vars.$parent.scrollLeft( _this.vars.posX + x );
@@ -154,7 +160,7 @@ $.widget( "oml.dragpan", {
154160
if (this._state() === 'off') {
155161
// Set the cursor
156162
_this.options.$parent.css( "cursor", _this.options.cursor );
157-
163+
158164
// Disable selection dragging
159165
_this.vars.$parent.css( "-webkit-touch-callout", "none" );
160166
_this.vars.$parent.css( "-webkit-user-select", "none" );
@@ -190,10 +196,11 @@ $.widget( "oml.dragpan", {
190196

191197
// Remove the mouse binding
192198
this._removeMouseBinding();
193-
199+
194200
// Set the state to off
195201
_this.vars.state = 'off';
196202
}
197203
}
198-
204+
199205
});
206+
})();

0 commit comments

Comments
 (0)