Component for creating vertical mini-map on html-page for document.body element.
Component inject in DOM of page and has position: fixed.
npm install dom-vertical-mini-mapDownload files from repository and use on page:
<link rel="stylesheet" href="dom-vertical-mini-map.css" />
<script src="dom-vertical-mini-map.js"></script>| Name | Description |
|---|---|
| MapElement | root HTMLElement of DomVerticalMiniMap |
| ScrollMapElement | HTMLElement represented Window on MapElement. |
| MapPointElement | HTMLElement represented founded HTMLElement on MapElement. |
| Name | Type | Required | Description |
|---|---|---|---|
| styles | Object | false | Styles of MapElement. |
| scroll | Object | false | Options of ScrollMapElement. |
| points | Array | true | Array of objects. Every object configure one MapPointElement. |
| Name | Type | Required | Values | Default | Description |
|---|---|---|---|---|---|
| backgroundColor | String | false | rgba(248, 249, 250, 1) |
Value of CSS property background-color of MapElement. | |
| borderColor | String | false | rgba(108, 117, 125, 1) |
Value of CSS property border-color of MapElement. | |
| position | String | false | left, right |
right |
Position of MapElement on page. |
| width | String | false | 1rem |
Value of CSS property width of MapElement. | |
| zIndex | Number | false | 1000 | Value of CSS property z-index of MapElement. |
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| enabled | Boolean | false | true | Enables ScrollMapElement. |
| styles | Object | false | Styles of ScrollMapElement. |
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| backgroundColor | String | false | rgba(108, 117, 125, 0.3) |
Value of CSS property background-color of ScrollMapElement. Use alpha for opacity. |
| Name | Type | Required | Description |
|---|---|---|---|
| draw | Object | true | Configure drawing of MapPointElement. |
| focus | Object | false | Configure focus for MapPointElement. |
| scroll | Object | false | Configure scroll for MapPointElement. |
| titleConstructor | Array | false | Array of objects. Every object concat text for title attribute of MapPointElement. Text separates by \n. Priorities for concat of one object: text, textContent, attribute. |
| Name | Type | Required | Description |
|---|---|---|---|
| selector | String | true | CSS selector for searching HTMLElements on page by document.querySelectorAll(). |
| selectorContains | String | false | CSS selector for searching by querySelector() HTMLElement in element. Filter elements founded by draw.selector if specified. |
| styles | Object | false | Styles of MapPointElement. |
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| backgroundColor | String | false | rgba(220, 53, 69, 1) |
Value of CSS property background-color of MapPointElement. |
| outlineColor | String | false | value of styles.borderColor | Value of CSS property outline-color on hover of MapPointElement. |
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| enabled | Boolean | false | false | Enables focus element on MapPointElement click. |
| selector | String | false | element founded by draw.selector | CSS selector for searching by querySelector() HTMLElement (for focus) in element founded by draw.selector. |
| Name | Type | Required | Values | Default | Description |
|---|---|---|---|---|---|
| enabled | Boolean | false | true | Enables scroll on MapPointElement click. | |
| selector | String | false | element founded by draw.selector | CSS selector for searching by querySelector() HTMLElement (for scroll) in element founded by draw.selector. | |
| type | String | false | top, bottom, middle |
top |
Scrolls the Window to element (top/bottom/middle of Window) in the Document. |
| Name | Type | Required | Description |
|---|---|---|---|
| text | String | false | Custom text. |
| selector | String | false | CSS selector for searching by querySelector() HTMLElement for analyze. |
| attribute | String | false | Take value from attribute of element founded by selector. |
| textContent | String | false | Take string from textContent of element founded by selector. |
| Name | Description |
|---|---|
| root | Return MapElement. |
| version | Return version of DomVerticalMiniMap. |
| Name | Description |
|---|---|
| create | Create and inject DomVerticalMiniMap component in DOM. |
| destroy | Reset DomVerticalMiniMap component and remove it from DOM. |
| refresh | Reinitialize MapPointElements and refresh styles of ScrollMapElement and MapPointElements. |
See examples.
