Show Foundation 5 Tooltip on Click

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 14:39:35

问题


I have a tooltip through foundation 5 on a span, like so:

<span data-tooltip aria-haspopup="true" class="has-tip tip-top" title="My tool tip"><i class="fi-pricetag-multiple size-21"></i></span>

This works fine. However, what I would like to do is only show the tooltip when a user clicks the span (instead of hovering). Then it closes when you click the a close button. I'm able to get halfway there when I add data-tooltip-open-event-type="touch" but this adds two tooltips and it still disapears when I hover away.

Any thoughts would be greatly appreciated. It seems odd that foundation 5 wouldn't have some sort of pop out for interactive content.

Thanks!


回答1:


Just needed to figure this out for myself too.

To show:

Foundation.libs.tooltip.getTip($('#yourId')).show()

To hide:

Foundation.libs.tooltip.getTip($('#yourId')).hide()



回答2:


Ron Marcelle has found it in Foundation tooltip source:

Foundation.libs.tooltip.showTip( jQuery( ".has-tip" ) );

Taken from How can i make Foundation tooltip show on focus?



来源:https://stackoverflow.com/questions/26163088/show-foundation-5-tooltip-on-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!