Click to toggle data in collapsable list. Depends on jQuery.
// keys for nested objects will be rendered as collapsables. Other values are ignored and rendered as a list item.
var data = {
'Quality': {
'increase quality': {
'tomorrow' : null
}
},
'Efficiancy': {
'be faster': null
},
'Delivery': null
};
// constructor(Object, rootElementId)
// rootElementId needs to be present in the DOM
var collapsable = new Collapsable(data, 'root');
demo with some optional styling.
- pass obj as data
- only add icon on collapsables
- moar component style
- option to set some styling
- remove jQuery and add some vue.js magic?
MIT