Permalink
Browse files

UDM support added (CommonJS/Browserify included)

1 parent 5c371cd commit 663d3c2169d84e98fd371f8e4b706387f340bcdc @jesusprubio jesusprubio committed Mar 3, 2015
Showing with 53 additions and 2 deletions.
  1. +16 −0 README.md
  2. +13 −2 jquery.dropdown.js
  3. +24 −0 package.json
View
@@ -59,3 +59,19 @@ You may add a new option to the select tag and it will be automatically added to
### Let users add options ### Let users add options
Add `data-dynamic-opts=true` to the select tag to let users add or remove options. Add `data-dynamic-opts=true` to the select tag to let users add or remove options.
+
+### Browserify
+
+This library is [UMD](https://github.com/umdjs/umd) compatible, so you can use it in this way:
+
+```javascript
+var jquery = require("jquery");
+require("dropdown.js");
+
+jquery.material.init();
+
+jquery(document).ready(function() {
+ $(".select").dropdown({"optionClass": "withripple"});
+});
+...
+```
View
@@ -1,6 +1,17 @@
/* globals jQuery, window, document */ /* globals jQuery, window, document */
-(function($) { +(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['jquery'], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS
+ module.exports = factory(require('jquery'));
+ } else {
+ // Browser globals
+ factory(jQuery);
+ }
+}(function($) {
var methods = { var methods = {
options : { options : {
@@ -327,4 +338,4 @@
} }
}; };
-})(jQuery); +}));
View
@@ -0,0 +1,24 @@
+{
+ "name": "dropdown.js",
+ "version": "0.0.2dev",
+ "description": "Finally a dropdown plugin that transforms select inputs in nice dropdowns and does not drive you crazy.",
+ "main": "jquery.dropdown",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/FezVrasta/dropdown.js.git"
+ },
+ "keywords": [
+ "dropdown",
+ "dropdown.js",
+ "choosen",
+ "selectize",
+ "select",
+ "multiselect"
+ ],
+ "author": "FezVrasta",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/FezVrasta/dropdown.js/issues"
+ },
+ "homepage": "https://github.com/FezVrasta/dropdown.js"
+}

0 comments on commit 663d3c2

Please sign in to comment.