foundation-sites: [Tooltips] Instantiating tooltips recommended way doesn't seem to work (Meteor)
We are following the documentation on Atmosphere and not using $(document).foundation(), but instead are instantiating plugins using the Foundation plugins API. This works fine with our Reveals, Accordions and several other plugins, however, is not working with Tooltips. The tooltips will work when you use $(document).foundation(), but we need more control over the plugins. Below is how we are using tooltips:
<span id="messageTooltip" data-tooltip aria-haspopup="true" class="has-tip top" data-disable-hover='false' tabindex=1 title={{message}}>{{shorten message}}</span>
Template.generalTasksTable.onRendered(function () {
this.tooltip = new Foundation.Tooltip($('#messageTooltip'));
});
Template.generalTasksTable.onDestroyed(function () {
let tooltip = this.tooltip;
if (tooltip) {
tooltip.destroy();
}
});
We have also tried targeting the .has-tip class as well, but no luck with that also. Just to make sure we aren’t doing anything odd with Meteor, I have tried var tooltip = new Foundation.Tooltip($("#messageTooltip")); in the Chrome console, but that yielded no tooltips as well.
Thanks for any help!
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 18 (11 by maintainers)
Hi @mtomov,
can you open a new issue and fill out the issue template with all relevant details?
A simple fix is to set
showOn: 'all'until Zurb fixes the code.As @juliancwirko said, the issue starts with this line
I looked at the MediaQuery util and found some odd things which are likely preventing it from firing.
They use this line to extract the styles, but when I run it in the console, I get
undefined.However, on the Foundation Docs page, the same line returns
which comes from a
metaclass that is attached when you runFoundationon the entire page. RunningFoundationalso initializes the MediaQuery class. And since we’re initializing per template, we don’t get these.So, I think a good solution would be to:
_initin thegetandatLeastmethods if queries is empty.defaultQueriesobject to includesmall,medium,large,xlarge, andxxlargequeries and then use thedefaultQueriesif no meta class is found.I’ll go do this and create a pull request.