How do I show Tipsy tooltip on load and keep it shown?

丶灬走出姿态 提交于 2019-12-23 21:29:51

问题


I've just installed Tipsy Tooltip (http://onehackoranother.com/projects/jquery/tipsy/) script on my wordpress site, I'm just wondering how I go about showing the tooltip on page load and keeping it shown.

This is the code I have so far;

<a id="logo" href="#" original-title="Happy <?php echo date("l"); ?>"></a>
<script type='text/javascript'>
  $("a#logo").tipsy('show');
</script>

Thanks in advance! :)


回答1:


Well, first you have to specify the attribute you want to use instead of title, in your case original-title. Then the trigger must be set to manual. And last we want to show the tooltip, when this is done.

 $('#logo').tipsy({trigger: 'manual', title: 'original-title'});
 $('#logo').tipsy('show');



回答2:


Use document ready method:

$(document).ready(function() {
  $("a#logo").tipsy('show');
});


来源:https://stackoverflow.com/questions/12443762/how-do-i-show-tipsy-tooltip-on-load-and-keep-it-shown

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