Now using the dom level 3 API for parsing. Also extended the test case
[utils] / wicket / components / src / main / resources / org / wamblee / wicket / behavior / wamblee-tooltip.js
index 016fa492ce54345e1989c997d8536fb2b1031924..3bdd99d13b218d1469cbc25922ba32cc855bb5f8 100644 (file)
@@ -34,6 +34,9 @@
 
                // Show the tooltip.
                var tooltipShow = function(event) {
+                       timerid = setTimeout(function() {
+                               content.fadeIn(options.fadein);
+                       }, options.delay);
                        var content = $("#tooltipContent").text(text).css({
                                position : "absolute",
                                top : event.pageY + 5,
                                padding : options.padding,
                                background : options.background
                        });
-                       timerid = setTimeout(function() {
-                               content.fadeIn(options.fadein);
-                       }, options.delay);
-
                        // console.log("start");
                };
 
                // Hide the tooltip.
                var tooltipHide = function(event) {
-                       $("#tooltipContent").fadeOut(options.fadeout);
                        if (timerid) {
                                console.log("clear timeout");
                                clearTimeout(timerid);
                                timerid = undefined;
                        }
+                       $("#tooltipContent").fadeOut(options.fadeout);
                }
 
                // Add hover listeners.