Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/juicy/juicy-highlight

Custom Element that highlights a DOM element on screen using a SVG overlay and/or border
https://github.com/juicy/juicy-highlight

plain-js used-in-starcounter-app

Last synced: 11 days ago
JSON representation

Custom Element that highlights a DOM element on screen using a SVG overlay and/or border

Awesome Lists containing this project

README

        

# <juicy-highlight>

`` is a Custom Element that highlights a DOM element on screen using a SVG overlay and/or border

## Demo

[Check it live!](http://juicy.github.io/juicy-highlight)

## Usage

1. Install the component using [Bower](http://bower.io/):

```sh
$ bower install juicy-highlight --save
```

2. Import Custom Element:

```html

```

3. Start using it!

```html


document.addEventListener("DOMContentLoaded", function() {
setTimeout(function() {
document.querySelector("#border").show(document.querySelectorAll("li"));
}, 100);
});

```

## Attributes

Attribute | Type | Default | Description
--- | --- | --- | ---
`overlay` | *Boolean* | `false` | Whether the overlay should be displayed
`strokeWidth` | *Number* | `1` | Border width in px
`strokeColor` | *String* | `#000000` | Border color
`strokeOffset` | *Number* | `1` | Border offset (distance from the element) in px
`fill` | *Color* | `none` | Color to fill selected area. Accepts HEX `#FFFF00`, RGB `rgb(255,255,0)`, RGBA `rgba(255,255,0,0.5)`, and color name `yellow`.

## Private properties

Property | Type | Description
--- | --- | ---
`overlayRect` | *SVG* | The overlay SVG element.
`focusRect` | *SVG* | The focus SVG element.

## Methods

Name | Param name | Type | Description
--- | --- | --- | ---
`show` | | | Highlight element(s)
| elements | *null*, *Element*, *Array* or *NodeList* | DOM element or array of those to highlight. If no elements are specified, only overlay will be shown (if applicable)
`hide` | | | Hide current highlight

## Contributing

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -m 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## License

MIT