Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show tooltip only on directly selected child element. #497

Closed
Rokko11 opened this issue Nov 20, 2015 · 3 comments
Closed

Show tooltip only on directly selected child element. #497

Rokko11 opened this issue Nov 20, 2015 · 3 comments

Comments

@Rokko11
Copy link

Rokko11 commented Nov 20, 2015

Hi! Given, I have following html with JavaScript for tooltipsting and unimportant css. (Or just use my jsfiddle-link

<div id="outer" data-tooltip="outer text" class="dotooltip">
    <div id="inner" data-tooltip="inner text" class="dotooltip">text</div>
</div>

<script type="text/javascript">
    $(document).ready(function(){
        $('.dotooltip').each(function () {
            $(this).tooltipster({
                interactive: true,
                content: $(this).attr("data-tooltip")
            });
        });
    });
</script>

<style>
    #outer {
        border: red 1px solid;
        padding-left: 10%;
        padding-top: 10%;
        width: 300px;
        height: 100px
    }
    #inner {
        width: 100px;
        border: red 1px solid
    }
</style>

Is there any possibility to disable the outer tooltip when triggering the inner tooltip? At the moment both tooltips are getting displayed.
bildschirmfoto 2015-11-20 um 10 04 15

Kind Regards,
Rokko

@louisameline
Copy link
Collaborator

Hi, yes you can. I suggest you use the experimental Tooltipster v4 to accomplish that.
In the functionBefore callback, you'll have to get all the parents of the inner field, provide them to the instances static method to get the instances of all tooltips on parents, and call the close method on these instances.

@louisameline
Copy link
Collaborator

Or if you want a less generic solution, v3 is just as good, do something like this in the inner tooltip functionBefore callback:

functionBefore: function(){
    $('#outer').tooltipster('hide');
}

@e-motiv
Copy link

e-motiv commented Mar 8, 2024

For those people arriving here, llike me, to find the complete code solution -> #828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants