Add jQuery example to documentation

This commit is contained in:
Josh Johnson 2016-08-01 20:00:24 +01:00
parent 6a6988f71b
commit 677d3a5582
3 changed files with 80 additions and 82 deletions

View file

@ -23,6 +23,9 @@ A lightweight, configurable select box/text input plugin. Similar to Select2 and
const choices = new Choices('[data-choice']);
const choices = new Choices('.js-choice');
// Pass jQuery element
const choices = new Choices($('.js-choice')[0]);
// Passing options (with default options)
const choices = new Choices(elements, {
items: [],

View file

@ -844,8 +844,6 @@ export class Choices {
* @private
*/
_onMouseDown(e) {
// If not a right click
// if(e.button !== 2) {
const activeItems = this.store.getItemsFilteredByActive();
const target = e.target || e.touches[0].target;
@ -934,7 +932,6 @@ export class Choices {
this.toggleDropdown();
}
}
// }
}
/**
@ -1603,7 +1600,6 @@ export class Choices {
_addEventListeners() {
document.addEventListener('keyup', this._onKeyUp);
document.addEventListener('keydown', this._onKeyDown);
// document.addEventListener('touchstart', this._onMouseDown);
document.addEventListener('mousedown', this._onMouseDown);
document.addEventListener('mouseover', this._onMouseOver);
@ -1625,7 +1621,6 @@ export class Choices {
_removeEventListeners() {
document.removeEventListener('keyup', this._onKeyUp);
document.removeEventListener('keydown', this._onKeyDown);
// document.removeEventListener('touchstart', this._onMouseDown);
document.removeEventListener('mousedown', this._onMouseDown);
document.removeEventListener('mouseover', this._onMouseOver);

View file

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
<title>Choices</title>
<meta name=description itemprop=description content="A lightweight, configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency.">