Some javascript optimizations
authorMarcel Werk <burntime@woltlab.com>
Wed, 2 Nov 2011 17:17:13 +0000 (18:17 +0100)
committerMarcel Werk <burntime@woltlab.com>
Wed, 2 Nov 2011 17:17:13 +0000 (18:17 +0100)
wcfsetup/install/files/js/WCF.js

index d4e4e454e36b7d431e8ebb82395bd95e9978c998..e22460e56054d9d6ce40a40e97458b3aa75e0c59 100644 (file)
@@ -2665,16 +2665,19 @@ WCF.Effect.BalloonTooltip.prototype = {
                this.tooltip = $('<div id="balloonTooltip" style="position:absolute"></div>').appendTo(document.body).hide();
        
                // init elements
-               $('.balloonTooltip').each($.proxy(this._initTooltip, this));
+               $('.balloonTooltip').live('mouseenter', $.proxy(this._initTooltip, this));
        },
        
-       _initTooltip: function(index, element) {
-               $(element).hover(
+       _initTooltip: function(event) {
+               $(event.currentTarget).die('mouseenter');
+               $(event.currentTarget).removeClass('balloonTooltip');
+               
+               $(event.currentTarget).hover(
                        $.proxy(this._mouseEnterHandler, this), 
                        $.proxy(this._mouseLeaveHandler, this)
                );
                
-               $(element).mousemove(
+               $(event.currentTarget).mousemove(
                        $.proxy(this._mouseMoveHandler, this)   
                );
        },