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
import GaspardCollection from 'gaspard-collection'
const GaspardCollection = require('gaspard-collection')
const collection = new GaspardCollection('div.highlight')
collection
.css('background-color', 'green')
.find('p:first-child')
.addClass('introduction')
.fadeIn(400)
.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