Hello everyone, I'm still learning php and used the tooltip creation form to get started with jquery.

There's just one problem: it doesn't function! Nonetheless, it appears to me that I followed the instructions correctly...

I'll let you assess my js code for yourselves. It was created using Dreamweaver CS4:
Please accept my sincere gratitude.// JavaScript Document
$ (function () {
$ ('a'). Mouscover (function () {
if ($ (this) .attr ('title') == '') return false;
$ ('body') .append ('<span class = "tooltip"> </span>');
var bubble = $ ('. tooltip');
bubble.append ($ (this) .attr ('title'));
var posTop = $ (this) .offset (). top - $ (this) .height ();
var posLeft = $ (this) .offset (). left + $ (this) .width () / 2-bubble.width () / 2;
bubble.css ({
left: posLeft,
top: posTop-10,
opacity: 0
});
bubble.animate ({
top: posTop,
opacity: 0.99
}, 1000);
});
$ ('a'). mouscout (function () {
$ ('. tooltip'). remove ();
});
});
download zolaxis patcher

2 réponses


popotte
Réponse acceptée

first Ill just repost the code bec it hard to read like this x)

$ (function () {
  $ ('a'). Mouscover (function () {
    if ($ (this) .attr ('title') == '') return false;

    $ ('body') .append ('<span class = "tooltip"> </span>');

    var bubble = $ ('. tooltip');

    bubble.append ($ (this) .attr ('title'));

    var posTop = $ (this) .offset (). top - $ (this) .height ();
    var posLeft = $ (this) .offset (). left + $ (this) .width () / 2-bubble.width () / 2;

    bubble.css ({
        left: posLeft,
        top: posTop-10,
        opacity: 0
    });

    bubble.animate ({
        top: posTop,
        opacity: 0.99
    }, 1000);
    }); // ?!?!?!

  $ ('a'). mouscout (function () {
    $ ('. tooltip'). remove ();
  });
});

So, there are a problem just after bubble.animate U hav an unexpected }); :o