Skip to content

only a single delegated tooltip selector is supported on a node #14167

Closed

Description

@ashanbrown

Based on my experience and my reading of the code, you only can only call tooltip once on a node, so if you want to set up multiple selectors with different default values, behaviors, etc, you are out of luck. In the following example, only "Hover over me" gets a tooltip:

<span title="hover-tooltip" class="hover-tooltip">Hover over me</span>
<span title="click-tooltip" class="click-tooltip">Click on me</span>
<script>
  $('body').tooltip({selector: '.hover-tooltip', trigger: 'hover'});
  $('body').tooltip({selector: '.click-tooltip', trigger: 'click'});
</script>

Seems like it would be nice to be able to set up multiple delegated selectors on a node. Would probably require a bit of work though, but if there's an interest in this, I could work on a pull request.

Activity

  1. hnrch02 commented on Jul 17, 2014

    @hnrch02
    Collaborator

    Interesting. Could you compile a live test case demonstrating this? Preferably using something like JS Bin.

  2. hnrch02 commented on Jul 17, 2014

    @hnrch02
    Collaborator

    Also, implementing this would require a fair bit of change to the current tooltip plugin, not sure if that would be worth the hassle – you could add a wrapper and use that instead of the body to delegate from.

  3. ashanbrown commented on Jul 17, 2014

    @ashanbrown
    ContributorAuthor

    I can't seem to get tooltips to work at all on jsbin. It looks like it would require work, but having to restructure your html and your css to work around it is a bit of a pain. Also, in my case, I'm using turbolinks, so the layer of hierarchy would need to be between html and body unless I want to rebuild my handlers every time I fetch a page (which is what I am doing now).

  4. hnrch02 commented on Jul 17, 2014

    @hnrch02
    Collaborator

    Here's a bin.
    I'm sure we'd take a PR into consideration, but as I said, can't guarantee anything.

  5. ashanbrown commented on Jul 17, 2014

    @ashanbrown
    ContributorAuthor

    Thanks for the bin. I should have been able to figure the bin out myself but I must not do my best work at that hour (I must have been running script before jquery was loaded).

    Anyhow, I assume that popover has the same problem as well as any other delegated handlers. I'll take a look into it as well.

  6. mdo commented on Aug 2, 2014

    @mdo
    Member

    Closing for the pull request.

  7. added a commit that references this issue on Oct 26, 2014
    1b32376
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature, or a change to how an existing one worksjsJavaScript or TypeScript sources and plugins

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions