问题
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