Skip to content

Commit e6a989f

Browse files
author
Lawrence Goldstien
committed
Update readme for release 1.0.1
1 parent a9c037f commit e6a989f

File tree

2 files changed

+65
-40
lines changed

2 files changed

+65
-40
lines changed

README.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ Download the [production version][min] or the [development version][max].
88
[min]: https://raw.github.com/lgoldstien/jquery-dragpan/master/dist/dragpan.min.js
99
[max]: https://raw.github.com/lgoldstien/jquery-dragpan/master/dist/dragpan.js
1010

11+
###Requirements
12+
13+
jQuery Dragpan has the following requirements:
14+
15+
* [jQuery](http://jquery.com/download/)
16+
* [jQuery UI](http://jqueryui.com/download/)
17+
* Requires UI Core - Core and Widget
18+
1119
###Usage
1220

1321
<div id="document">
@@ -24,6 +32,8 @@ Download the [production version][min] or the [development version][max].
2432

2533
###Options
2634

35+
Options can be parsed when Dragpan is instatiated on an element or after.
36+
2737
####Speed
2838

2939
You can adjust the speed of the drag using the speedX and speedY options.
@@ -40,11 +50,26 @@ You can set the parent element, this is useful if the viewport sized element is
4050

4151
By default this will be the element you are using the dragpan method on.
4252

43-
## Documentation
44-
_(Coming soon)_
53+
####On
54+
55+
You can tell dragpan to instantiate without enabling functionality using the following:
56+
57+
$("element").dragpan({ on: false });
58+
59+
This will default to true meaning if you do not specify this then the dragpan functionality will be enabled.
60+
61+
###Methods
62+
63+
You can use methods the following non-private methods:
64+
65+
####On
66+
67+
You can turn on dragpan functionality using the following on an already instantiated dragpan instance.
68+
69+
$("element").dragpan('on');
70+
71+
####Off
4572

46-
## Examples
47-
_(Coming soon)_
73+
You can turn off the dragpan functionality using the following on an already instantiated dragpan instance.
4874

49-
## Release History
50-
_(Nothing yet)_
75+
$("element").dragpan('off');

src/dragpan.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,6 @@ $.widget( "oml.dragpan", {
1010
},
1111
vars: {},
1212

13-
// The public functions
14-
on: function () {
15-
// Set the cursor
16-
_this.options.$parent.css( "cursor", _this.options.cursor );
17-
18-
// Disable selection dragging
19-
_this.vars.$parent.css( "-webkit-touch-callout", "none" );
20-
_this.vars.$parent.css( "-webkit-user-select", "none" );
21-
_this.vars.$parent.css( "-khtml-user-select", "none" );
22-
_this.vars.$parent.css( "-moz-user-select", "-moz-none" );
23-
_this.vars.$parent.css( "-ms-user-select", "none" );
24-
_this.vars.$parent.css( "user-select", "none" );
25-
26-
// Add the mouse binding
27-
this._addMouseBinding();
28-
},
29-
off: function () {
30-
// Enable selection dragging if it was enabled to begin with
31-
if (_this.vars.selection === true) {
32-
_this.vars.$parent.css( "-webkit-touch-callout", "all" );
33-
_this.vars.$parent.css( "-webkit-user-select", "all" );
34-
_this.vars.$parent.css( "-khtml-user-select", "all" );
35-
_this.vars.$parent.css( "-moz-user-select", "all" );
36-
_this.vars.$parent.css( "-ms-user-select", "all" );
37-
_this.vars.$parent.css( "user-select", "all" );
38-
}
39-
40-
// Set back to default cursor
41-
_this.options.$parent.css( "cursor", "default" );
42-
43-
// Remove the mouse binding
44-
this._removeMouseBinding();
45-
},
46-
4713
// The class construct
4814
_create: function() {
4915
// This fix
@@ -161,6 +127,40 @@ $.widget( "oml.dragpan", {
161127
_removeMouseBinding: function () {
162128
_this.vars.$parent.off();
163129
_this._dragging( 'off' );
130+
},
131+
132+
// The public functions
133+
on: function () {
134+
// Set the cursor
135+
_this.options.$parent.css( "cursor", _this.options.cursor );
136+
137+
// Disable selection dragging
138+
_this.vars.$parent.css( "-webkit-touch-callout", "none" );
139+
_this.vars.$parent.css( "-webkit-user-select", "none" );
140+
_this.vars.$parent.css( "-khtml-user-select", "none" );
141+
_this.vars.$parent.css( "-moz-user-select", "-moz-none" );
142+
_this.vars.$parent.css( "-ms-user-select", "none" );
143+
_this.vars.$parent.css( "user-select", "none" );
144+
145+
// Add the mouse binding
146+
this._addMouseBinding();
147+
},
148+
off: function () {
149+
// Enable selection dragging if it was enabled to begin with
150+
if (_this.vars.selection === true) {
151+
_this.vars.$parent.css( "-webkit-touch-callout", "all" );
152+
_this.vars.$parent.css( "-webkit-user-select", "all" );
153+
_this.vars.$parent.css( "-khtml-user-select", "all" );
154+
_this.vars.$parent.css( "-moz-user-select", "all" );
155+
_this.vars.$parent.css( "-ms-user-select", "all" );
156+
_this.vars.$parent.css( "user-select", "all" );
157+
}
158+
159+
// Set back to default cursor
160+
_this.options.$parent.css( "cursor", "default" );
161+
162+
// Remove the mouse binding
163+
this._removeMouseBinding();
164164
}
165165

166166
});

0 commit comments

Comments
 (0)