v2.0.0
This commit is contained in:
40
README.md
40
README.md
@@ -28,6 +28,10 @@ createTooltip(document.querySelector('button'), 'Подсказка');
|
||||
import { createTooltip } from '@advdominion/tooltip';
|
||||
|
||||
createTooltip(document.querySelector('button'), 'Подсказка', {
|
||||
animation: [
|
||||
[{ opacity: 0 }, { opacity: 1 }],
|
||||
[{ opacity: 1 }, { opacity: 0 }],
|
||||
],
|
||||
appendTo: document.body,
|
||||
arrow: true,
|
||||
delay: [0, 0],
|
||||
@@ -37,6 +41,7 @@ createTooltip(document.querySelector('button'), 'Подсказка', {
|
||||
interactive: true,
|
||||
offset: [0, 8],
|
||||
placement: 'top',
|
||||
shiftPadding: [8, 0],
|
||||
theme: 'light',
|
||||
trigger: 'mouseenter',
|
||||
virtialReference: undefined,
|
||||
@@ -76,8 +81,34 @@ createTooltip(document.querySelector('button'), 'Подсказка', {
|
||||
});
|
||||
```
|
||||
|
||||
#### Свойства
|
||||
|
||||
#### $tooltip
|
||||
|
||||
DOM-элемент всплывающей подсказки (имеет свойство `_reference` для доступа к элементу, на котором был вызван `createTooltip`)
|
||||
|
||||
#### options
|
||||
|
||||
Текущие настройки
|
||||
|
||||
#### isVisible
|
||||
|
||||
Видимость всплывающей подсказки - `true`/`false`
|
||||
|
||||
#### Методы
|
||||
|
||||
##### show
|
||||
|
||||
```js
|
||||
document.querySelector('button')._tooltip.show();
|
||||
```
|
||||
|
||||
##### hide
|
||||
|
||||
```js
|
||||
document.querySelector('button')._tooltip.hide();
|
||||
```
|
||||
|
||||
##### setContent
|
||||
|
||||
```js
|
||||
@@ -96,6 +127,12 @@ document.querySelector('button')._tooltip.updateOptions({ placement: 'bottom' })
|
||||
<button type="button" data-tooltip-placement="bottom">Кнопка</button>
|
||||
```
|
||||
|
||||
##### destroy
|
||||
|
||||
```js
|
||||
document.querySelector('button')._tooltip.destroy();
|
||||
```
|
||||
|
||||
### Стили
|
||||
|
||||
```scss
|
||||
@@ -113,6 +150,9 @@ $b: '.tooltip';
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
&__root {
|
||||
}
|
||||
|
||||
&__arrow {
|
||||
#{$b}_theme_light & {
|
||||
background-color: white;
|
||||
|
Reference in New Issue
Block a user