New Project, Monday

    jquery-pluginconfig

    0.0.2 • Public • Published

    jquery-pluginconfig

    Build Status

    Installation

    You can install with npm

      $ npm install jquery-pluginconfig

    With Bower

      bower install jquery-pluginconfig

    Or use some of the files at dist folder.

    Usage

    Let's say you have a jQuery plugin called my-awesome-plugin. And you want to allow the user to set the configs of that plugin for a given element using data-* attributes.

    You can let them do this:

      <div class="my-element" data-my-awesome-plugin-config="hello" data-my-awesome-plugin-config-two="world"></div>div>

    And then you can do this:

      var config = $('.my-element').pluginConfig('my-awesome-plugin');
    
      // You'll get { config: "hello", configTwo: "world"}
    
      // Then use it
    
      $('.my-element').myAwesomePlugin(config);

    You can also use it internally of your plugin, so the user won't have to call pluginConfig every time.

    That's all, folks!

    Install

    npm i jquery-pluginconfig

    DownloadsWeekly Downloads

    11

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • talyssonoc