j-Suggestion
- Podporuje 3 orientace
left,centeraright - singleton
- Systém Bootstrap Grid
- Práce s dotykem
- Podporuje tmavý režim
Metody:
Metoda: component.show(orientation, targetElement, [items/function(search, next)], clickCallback)
orientation {String}může býtleft,centerneborighttargetElement {Selector/jQuery/Element}je cílem, kde bude složka viditelnáitems {Array}je volitelný a musí mít tuto strukturu: jinak bude[{ name: String, value: String, icon: String }]číst položky z atributu cíledata-options.callback(selectedItem) {Function}je vyvolán, když uživatel klikne na položku
Metoda: component.hide()
Atributy:
targetElementmůže obsahovat atributdata-options="Name 1|ti-building|Value 1;Name 2|ti-github|Value 2;"se všemi položkami v kontextu.
Konfigurace:
placeholder- místo pro vyhledávací vstup
Serverové stránky vyhledávání:
SETTER('suggestion', 'show', element, function(search, next) {
next([{ name: 'Item 1' }, { name: 'Item 2' }]);
}, function(selected) {
console.log(selected);
});Pokud není value definován, pak složka používá name jako value.
Globální události:
ON('suggestion', function(visible, component, target) {
console.log('Suggestion is', visible ? 'visible' : 'hidden');
});Použijte ji s <ui-component name="suggestion">Pokud je součástka ještě nezačleněna, jComponent Stáhnout ji na první použití z adresy DEF.fallback a) The Componentator CDN dle předvolby. autor: Peter Širka. zdroj: Componentator Výrobce je autorizován, MIT licence.
<style>
body { background-color: #F0F0F0; }
</style>
<ui-component name="suggestion" config="placeholder:Search ..."></ui-component>
<div class="container">
<a href="javascript:void(0)">Suggest</a>
</div>
<script>
$(document).on('click', 'a', function() {
SETTER('suggestion/show', 'left', this, [{ name: 'Total.js' }, { name: 'Express.js' }, { name: 'Meteor.js' }, { name: 'Koa.js' }, { name: 'ASP.NET' }, { name: 'PHP' }, { name: 'Python' }, { name: 'Node.js' }], function(value) {
console.log('CLICK', value);
});
});
</script>