You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
only a single delegated tooltip selector is supported on a node #14167
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:
<spantitle="hover-tooltip" class="hover-tooltip">Hover over me</span><spantitle="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.
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.
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).
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.
Activity
hnrch02 commentedon Jul 17, 2014
Interesting. Could you compile a live test case demonstrating this? Preferably using something like JS Bin.
hnrch02 commentedon Jul 17, 2014
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.
ashanbrown commentedon Jul 17, 2014
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).
hnrch02 commentedon Jul 17, 2014
Here's a bin.
I'm sure we'd take a PR into consideration, but as I said, can't guarantee anything.
ashanbrown commentedon Jul 17, 2014
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.
mdo commentedon Aug 2, 2014
Closing for the pull request.
Allow multiple delegated tooltip selectors on a node
Revert "Allow multiple delegated tooltip selectors on a node"