tooltip.md

April 24, 2022 ยท View on GitHub

Tooltips & Menu

Tips Usage

import {Tips} from 'butterfly-dag';
let container = document.getElementById('.you-target-dom');
Tips.createTip({
  className: `butterfly-custom-tips`,
  targetDom: container,
  genTipDom: () => { return $('<div>content</div>')[0] },
  placement: 'right'
});
import {Tips} from 'butterfly-dag';
let container = document.getElementById('.you-target-dom');
Tips.createMenu({
  className: `butterfly-custom-menu`,
  targetDom: container,
  genTipDom: () => { return $('<div>content</div>')[0] },
  placement: 'right',
  action: 'click',
  closable: true
});

API

attrdesctyperequiredefault
classNameclass namestringnoempty
placementshow directionstringnoright
xx coordinatestringnoempty
yy coordinatestringnoempty
closableclick other blank space to closestringnoempty
viewAppendthe dom which tips appenddomnobody
targetDomthe dom of tips or menu appearsHTML DOMyesempty
genTipDomthis method returns a DOM to display the contents of the tips or menufunctionyesempty