Skip to content

Commit

Permalink
Add user-definable default options, and browser/device testing detail…
Browse files Browse the repository at this point in the history
…s to README.
  • Loading branch information
Hilton Janfield committed Sep 13, 2015
1 parent 232a6af commit cf82e73
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 18 deletions.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,51 @@ jQuery(function ($) {
}
```
Defaults
--------
To change the default value for any setting for your entire page, use the .defaults object:
```javascript
$.fn.enhsplitter.defaults.splitterSize = '13px';
```
## Testing
Officially, jquery.enhsplitter follows the same device support program as jQuery 2.x.
We test on as many browsers and devices as we can, starting with the major ones.
### Windows and Linux
- [x] Firefox 40 (primary testing platform)
- [x] Chrome 45
- [x] Internet Explorer 11
Have you installed Windows 10? Give us an Edge report!
### Mac OS X
We do not have easy access to any Apple systems. If you are using one, please
[try everything in the test file](http://www.janfield.ca/github/jquery.enhsplitter/test.html)
and send us a report!
### Touch Screen Devices
On sites specifically designed for mobile, It is recommended to use the `splitterSize` option or custom CSS to increase
the width of the splitter. Using custom CSS to increase the size of the collapse handle is also recommended if it is
intended to be used; it should be disabled otherwise as it is too awkward to hit on mobile devices.
Future revisions will include special CSS for mobile and touch screen devices.
Currently tested and fully functional on the following, unless otherwise noted:
- [x] Android 5.0.1 - Internet 2.1.34.16
- [x] Android 5.0.1 - Chrome for Android 45.0.2454.84
- [ ] Android 5.0.1 - Firefox for Android 40.0.3 - Collapse handle clicks not working; everything else fine.
- [ ] iOS 8.4 - Mobile Safari - Collapse handle clicks are difficult and touchy; everything else fine.
We do not have easy access to any Surface-type devices. If you are using one, please
[try everything in the test file](http://www.janfield.ca/github/jquery.enhsplitter/test.html)
and send us a report! Although I expect everything to work the same as the Windows browsers listed above, we can't be
sure that they handle touch events the same as mouse.
## License
Expand Down
39 changes: 21 additions & 18 deletions js/jquery.enhsplitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,15 @@
(function ($, undefined) {
var splitterCount = 0;
var splitters = [];
var currentSplitter = null;
var currentSplitter = null; // Reference to current splitter during events.

$.fn.enhsplitter = function (options) {
var data = this.data('splitter');
if (data) {
return data;
}

var settings = $.extend({
limit: 100,
vertical: true,
position: '50%',
invisible: false,
handle: 'default',
fixed: false,
collapsable: true,
collapse: 'left',
height: null,
onDragStart: $.noop,
onDragEnd: $.noop,
onDrag: $.noop
}, options || {});
var settings = $.extend({}, $.fn.enhsplitter.defaults, options);

var id = splitterCount++;
var self;
Expand Down Expand Up @@ -215,10 +202,10 @@
if (splitters.length == 0) {
$(window)
.on('resize.splitter', function () {
$.each(splitters, function (i, splitter) {
splitter.refresh();
$.each(splitters, function (i, splitter) {
splitter.refresh();
});
});
});

$(document.documentElement)
.on('click.splitter', '.splitter_handle', function (e) {
Expand Down Expand Up @@ -354,5 +341,21 @@
splitters.push(self);
return self;
};

$.fn.enhsplitter.defaults = {
vertical: true,
limit: 100,
position: '50%',
invisible: false,
handle: 'default',
fixed: false,
collapse: 'left',
height: null,
splitterSize: null,
onDragStart: $.noop,
onDragEnd: $.noop,
onDrag: $.noop
};

})
(jQuery);

0 comments on commit cf82e73

Please sign in to comment.