import * as React from 'react'; import JqxButton from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxbuttons'; import JqxTooltip from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxtooltip'; class App extends React.PureComponent<{}, any> { private myTooltip = React.createRef(); private image = React.createRef(); private toggle: boolean = false; constructor(props: {}) { super(props); this.click = this.click.bind(this); } public render() { return (
Toggle tooltip
); } // Event handling private click(): void { if (this.toggle) { this.myTooltip.current!.close(); this.toggle = !this.toggle; } else { const imageElement = this.image.current!; const x = imageElement.offsetLeft - imageElement.width / 2 + 10; const y = imageElement.offsetTop + imageElement.height + 5; this.myTooltip.current!.open(x, y); this.toggle = !this.toggle; } } } export default App;