-
Notifications
You must be signed in to change notification settings - Fork 13
Usage
Mottie edited this page Jan 3, 2013
·
1 revision
There are two methods you can use to access the API:
-
Get the data object
// You can use any variable, I used "equalizer" here only as an example var equalizer = $('.wrapper').data('equalizer');
-
Get the api object
var equalizer = $('.wrapper').getequalizer();
Once you have the api object, the following is possible:
If you happen to have the resizable
option disabled (set to false
) and need to update Equalizer, use the built-in shortcut method to update:
// update equalizer by calling the function again, but with no options.
$('.wrapper').equalizer();
or use the api object:
var equalizer = $('.wrapper').data('equalizer');
equalizer.update();
// to disable trigger disable.equalizer on the main wrapper
$('.wrapper').trigger('disable.equalizer');
// use enable.equalizer to make it work again
$('.wrapper').trigger('enable.equalizer');
or use the api object:
var equalizer = $('.wrapper').data('equalizer');
// to disable the plugin, send a `false` boolean to the enable function
equalizer.enable(false);
// use enable the plugin, just call the enable function
equalizer.enable();
Once you have the api object you can access any of these variables, options or functions:
-
equalizer.update()
- direct access to the update function. -
equalizer.suspend(boolean)
- suspend equalizer (if boolean isfalse
) until the next resize/update. -
equalizer.enable(boolean)
- disable equalizer (if boolean isfalse
) until the enable function is called again (boolean is empty ortrue
). -
equalizer.options
- Access to the set options. You may update the options this way, but be warned that it may not work properly. Also make sure to use update, if anything is changed. -
equalizer.$el
- jQuery object of the main wrapper element (.wrapper
in the examples above). -
equalizer.$col
- jQuery object of all of the columns inside of the wrapper element. Targeted using thecolumns
option.