Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blivesta/check-pls
For find out if the target is 'Portrait' 'Landscape' or 'Square'.
https://github.com/blivesta/check-pls
Last synced: about 2 months ago
JSON representation
For find out if the target is 'Portrait' 'Landscape' or 'Square'.
- Host: GitHub
- URL: https://github.com/blivesta/check-pls
- Owner: blivesta
- Created: 2016-04-03T01:23:10.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-17T13:04:26.000Z (over 8 years ago)
- Last Synced: 2024-11-11T03:03:04.644Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 20.5 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CheckPLS
[![npm version](https://img.shields.io/npm/v/check-pls.svg?style=flat-square)](https://www.npmjs.com/package/check-pls)
[![Build Status](https://img.shields.io/travis/blivesta/check-pls/master.svg?style=flat-square)](https://travis-ci.org/blivesta/check-pls)For find out if the target is 'Portrait' 'Landscape' or 'Square'.
## Install
npm
```html
$ npm install check-pls
```CDN
```html```
## Usage
```js
checkPls(element) // => string ['portrait'||'landscape'||'square']
checkPls(element, 'portrait') // => boolean
checkPls(element, 'landscape') // => boolean
checkPls(element, 'square') // => boolean```
### Example
html
```html
```
use [`imagesLoaded`](http://imagesloaded.desandro.com/) `$ npm install imagesloaded````js
import imagesLoaded from 'imagesloaded'
import checkPls from 'check-pls'const elements = document.querySelectorAll('img')
const el = Array.apply(null, elements)
imagesLoaded(el, () => {
el.map((node) => {
const str = checkPls(node)
const bool = checkPls(node, 'landscape')
console.log(str)
console.log(bool)
})
})
```Result:
```js
// image-portrait.jpg
str => portrait
bool => false// image-landscape.jpg
str => landscape
bool => true// image-square.jpg
str => square
bool => false
```## License
Released under the MIT license.