How do I show tooltip onload

500 views
Skip to first unread message

alt

unread,
Jun 24, 2008, 3:47:40 AM6/24/08
to MooTools Users
Hi,

MooTools Tips is working great using the code below. But how do I
make the tooltip be visible when I first load the page and stay
visible for about a second?

Thanks!

window.addEvent('domready', function() {
var Tips = new Tips($$('.Tips'),
initialize:function() {
this.fx = new Fx.Style(this.toolTip, 'opacity',
{duration: 500,
wait: false} ).set(0);
},
onShow: function(toolTip) {
this.fx.start(1);
},
onHide: function(toolTip) {
this.fx.start(0);
}
});
});

alt

unread,
Jun 30, 2008, 2:07:43 AM6/30/08
to MooTools Users
Hi, does anybody have some pointers?

On Jun 24, 12:47 am, alt <albert.lm.t...@gmail.com> wrote:
> Hi,
>
>    MooToolsTipsis working great using the code below.  But how do I
> make the tooltip be visible when I first load the page and stay
> visible for about a second?
>
> Thanks!
>
>     window.addEvent('domready', function() {
>         varTips= newTips($$('.Tips'),

Wolfe Stuff

unread,
Jun 30, 2008, 2:34:05 AM6/30/08
to mootool...@googlegroups.com
maybe try attaching the mouseover event to an element, then firing the mouseover event on that element onload.

Gary Hussey

unread,
Jul 1, 2008, 2:24:04 AM7/1/08
to mootool...@googlegroups.com
tips uses the "mouse enter/leave" events so you'll need to fire the "mouseenter" event on the element you want the tip to display on, then set an interval to fire a "mouseleave" event on that element later.

EXAMPLE:

<script type="text/javascript">
        window.addEvent('load',function(){
           
            var mytips = new Tips('.tips',{
                fixed:true,//tip must be fixed for this to work
                offsets:{x:125,y:0}
            });
           
            var wait = setInterval(function(){
                clearInterval(wait);
                document.getElement('.tips.auto').fireEvent('mouseleave');
            }, 5000); //5 seconds
            document.getElement('.tips.auto').fireEvent('mouseenter');           
        });
    </script>


<div class="tips" title="header::this is the tip">text to tip</div>
<div class="tips" title="header::this is the tip">text to tip</div>
<div class="tips" title="header::this is the tip">text to tip</div>
<div class="tips auto" title="header::this is the tip">text to tip</div>

working example -> http://guildhyperion.com/autotips.html

Due to the nature of Tips one can only display a single tip at a time. For more functionality you'll need to extend Tips to create/manage separate tips for each element.

alt

unread,
Jul 1, 2008, 2:24:02 PM7/1/08
to MooTools Users
Perfect! I'll give this a try. Many thanks!
> On Mon, Jun 30, 2008 at 1:34 AM, Wolfe Stuff <wolfest...@gmail.com> wrote:
> > maybe try attaching the mouseover event to an element, then firing the
> > mouseover event on that element onload.
>
Reply all
Reply to author
Forward
0 new messages