# media-query-images

> Loads images based on media queries for better page performance.

Latest version **1.0.4** (published 2019-05-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install media-query-images
pnpm add media-query-images
yarn add media-query-images
bun add media-query-images
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2019-05-31 |
| First published | 2019-05-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | The C2 Group |
| Maintainers | thec2group |
| Keywords | media query, image |

## Links

- npm: https://www.npmjs.com/package/media-query-images
- Repository: https://github.com/TheC2Group/media-query-images
- Issues: https://github.com/TheC2Group/media-query-images/issues
- npm.io page: https://npm.io/package/media-query-images

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2019-05-31
- 1.0.3 — 2019-05-30
- 1.0.2 — 2019-05-30
- 1.0.1 — 2019-05-30

## README

# media-query-images

Loads images based on media queries for better page performance.

This plugin can be used on images or on divs (in the case of a background image).

Sample Usage
------------

```js

new MediaQueryImages('#myImageSelector', [
    {
        'mediaQuery': '(max-width: 749px)',
        'attrName': 'data-small'
        'retinaAttrName': 'data-small-retina' // optional - will provide a retina version of the image for devices that support it
    },
    {
        'mediaQuery': '(max-width: 1023px)',
        'attrName': 'data-medium'
    },
    {
        'attrName': 'data-large'
    }
], {
    'blankClass': 'hidden' // optional - will apply a class to images that don't have a source for that particular size
});

```

```html

<img src="" data-small="contentimages/home/hero-1-small.jpg" 
    data-small-retina="contentimages/home/hero-1-small-retina.jpg" 
    data-medium="contentimages/home/hero-1-medium.jpg" 
    data-large="contentimages/home/hero-1.jpg" alt="" id="myImageSelector">

```

---
_Source: https://npm.io/package/media-query-images · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
