Skip to content

Tooltipped children of tooltipped parents #828

@e-motiv

Description

@e-motiv

First of all, thanks for a good tooltip library.

I have elements with tooltips that are the children of elements with also tooltips. When you hover the child, both tooltips are shown. I have read issue #638 and #627, but it didn't solve everything. But I almost solved it myself. My code below works except when you leave the child at an edge that is the same edge of the parent. In that case the parent opens when not needed. (Or when you leave out the reopen code, the parent tooltip does not show when hovering back to it.)

Questions:

  1. Is my code the best approach ?
  2. How to solve the "common edge" problem?
$('.tooltip')
		.tooltipster({
			debug:true,
			animation: 'grow',
			interactive:true,
			repositionOnScroll:true,
			//trackOrigin:true,		//performance!
			delay: 200,
			delayTouch:200,
			contentAsHTML : true
		})
		//All elements with tooltip that have a parent with a tooltip
		.children('.tooltip')
			.tooltipster('option' , 'functionBefore' ,  (inst, helper) => {
				$(helper.origin).parents('.tooltip').tooltipster('disable');  
			})
			.tooltipster('option' , 'functionAfter' ,  (inst, helper) => {
				$(helper.origin).parents('.tooltip').tooltipster('enable').tooltipster('open');  
			})
		; 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions