gaspard-collection
v0.1.1
Published
Manipulate collection of DOM elements
Downloads
6
Maintainers
Readme
Gaspard-collection
Manipulate collection of DOM elements
:fire: Use gaspard's Collection to queries elements and perform actions on each :fire:
Getting started
Installing
npm | yarn | bower | jsDelivr ------------ | ------------- | ------------- | ------------- npm install gaspard-collection | yarn add gaspard-collection | bower install gaspard-collection | gaspard-collection.umd.js
Usage
Include gaspard-collection on your project
// Via ES2015 import statement
import GaspardCollection from 'gaspard-collection'
// or via Commonjs
const GaspardCollection = require('gaspard-collection')
const collection = new GaspardCollection('div.highlight')
collection
.css('background-color', 'green')
.find('p:first-child') // returns a new gaspard collection
.addClass('introduction')
.fadeIn(400)
.elements // Array of matched elements
.forEach(element => {
console.log('div.highlight first paragraph', element)
})
Or use gaspard-collection within a <script>
<script src="https://cdn.jsdelivr.net/npm/gaspard@latest/dist/gaspard.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gaspard-collection@latest/dist/gaspard-collection.umd.js"></script>
<script>
const collection = new GaspardCollection('div.highlight')
collection
.css('background-color', 'green')
</script>
API documentation
Contribute
- Fork the repository
- Clone it locally and install dependencies with npm (or yarn)
npm install
- Create a new branch
- Develop your feature/fix with tests running
npm run test:watch
- Commit, Push your branch and make a pull request on gaspard repository
Licensing
MIT License Copyright (c) 2017 Luca Perret