jQuery.fn.uilinks
This plugin is a supplemental API to the ui-links UI component. While ui-links
enables declaring a dynamically-rendered set of links, this plugin enables modification of existing instances of ui-links from client code. The uilinks jQuery plugin does not support creating new instances of ui-links UI components.
Methods
add
$('selector.ui-links').uilinks('add', newLink, options);
Adds a new link to an existing ui-links instance.
Options:
className
: CSS class name to apply to the wrapper<li>
when rendering links. This is equivalent to class names applies to<li>
nodes when declaring ui-links. (default: null)selected
: When selected is selected, pre-scrolls the ui-links to the link. This is equivalent to thedata-selected
<li>
attribute when declaring a ui-links component. (default: false)
insert
$('selector.ui-links').uilinks('insert', newLink, index, options);
Adds a new link to an existing ui-links instance at the specified 0-based index.
Options:
className
: CSS class name to apply to the wrapper<li>
when rendering links. This is equivalent to class names applies to<li>
nodes when declaring ui-links. (default: null)selected
: When selected is selected, pre-scrolls the ui-links to the link. This is equivalent to thedata-selected
<li>
attribute when declaring a ui-links component. (default: false)
remove
$('selector.ui-links').uilinks('remove', selector);
Removes links matching a provided selector
show
$('selector.ui-links').uilinks('show', target);
Shows the currently-hidden links. Equivalent to clicking 'more'. Target is an optional location at which to show the links. Defaults to the same place it would have by default
hide
// Hide a specific ui-links
$('selector.ui-links').uilinks('hide');
// Hide all ui-links
$.fn.uilinks.hide();
Hides the open ui links.
reconfigure
$('selector.ui-links').uilinks('reconfigure');
$('selector.ui-links').uilinks('reconfigure', options);
Reconfigures a rendered instance's minLinks
, maxLinks
, and direction
properties. Properties can be passed explicitly in options or read from the current values of the data-*
attributes.
list
// Lists all links
$('selector.ui-links').uilinks('list');
// Lists hidden-only links
$('selector.ui-links').uilinks('list', { hidden: true });
Related:
- links UI Component
- ui.links.show Client Message
- ui.links.hide Client Message