storm-slides
Version:
Slides/carousel/fader/slider component
24 lines (20 loc) • 691 B
JavaScript
/**
* @name storm-slides: Slides/carousel/fader/slider component
* @version 0.3.4: Fri, 29 Jun 2018 12:18:32 GMT
* @author stormid
* @license MIT
*/
import defaults from './lib/defaults';
import componentPrototype from './lib/component-prototype';
const init = (sel, opts) => {
let els = [].slice.call(document.querySelectorAll(sel));
//let els = Array.from(document.querySelectorAll(sel));
if(!els.length) throw new Error('Slides not initialised, no augmentable elements found');
return els.map((el) => {
return Object.assign(Object.create(componentPrototype), {
node: el,
settings: Object.assign({}, defaults, opts)
}).init();
});
};
export default { init };