- No dependencies!
- Supports: IE10+, Chrome 45+, Firefox 43+, Safari 9+
- 2kb minified and gzipped
npm install labelr
bower install labelr
You can download the scripts yourself and include with a script tag
<script type="text/javascript" src="lablr.js"></script>
or
require('flatpickr')
labelr('selector', [options]);
call labelr
<script>
labelr('.label');
</script>
Defaults to the title attribute for label text
<img title="hello world" src="hello.jpg" class="label"></img>
<script>
labelr('.label', {attribute: 'alt'});
</script>
<img alt="this is alt" src="hello.jpg" class="label"></img>
<script>
labelr('.label', {style: {backgroundColor: 'indigo', color: 'white'}});
</script>
Most css styles are available
<img title="style changed" src="styles.svg" class="label"></img>
An example settings object might look something like
{
attribute: 'alt',
style: {
backgroundColor: 'indigo',
color: 'white'
fontFamily: 'serif'
}
}
* alt
* title
* fade
* popup
* Any styles included as CSS javascript object