Skip to content

agat/jquery.starter

Repository files navigation

jQuery Starter

A jQuery plugin to start another jQuery plugin.

Getting Started

Download the production version or the development version.

In your web page include jQuery, Starter and others you needed plugins (Bootstrap Tooltips plugin as example):

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="jquery.starter.min.js"></script>
...
<script src="bootstrap-tooltip.js"></script>

If you needed run Tooltips plugin on DOM element, simply add data-starter="tooltip" attribute for him.

<a href="#" data-starter="tooltip" title="first tooltip">hover over me</a>

Try on jsfiddle - jQuery Starter plugin demo.

Passing arguments to started plugin

All data- attributes(except data-starter) converted to object and pass to the started plugin.

<a href="#" data-starter="tooltip" data-placement="top">hover over me</a>

Passed data to the plugin:

{
    "placement": "top"
}

Same:

$('a').tooltip({
    placement: 'top'
});

If you have to pass the nested object:

<a href="#" data-starter="plugin" data-nested-object='{ "childObject": { "key": "value" } }'>some text</a>

Attention to the quotes. Passed data to the plugin:

{
    "nestedObject": {
    	"childObject": {
            "key": "value"
        }
    }
}

Options

plugin {string}

Started jQuery plugin name.

$('div').starter({
    plugin: 'tooltip'
});

arguments {object}

Arguments for started jQuery plugin.

$('div').starter({
    plugin: 'tooltip',
    arguments: {
        animation: false
    }
});

Simpe string argument:

$('div').starter({
    plugin: 'tooltip',
    arguments: 'show'
});

About

A jQuery plugin to start another jQuery plugin.

Resources

License

Stars

Watchers

Forks

Packages

No packages published