Improved WCF.Popover
authorAlexander Ebert <ebert@woltlab.com>
Mon, 15 Oct 2012 18:03:51 +0000 (20:03 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 15 Oct 2012 18:03:51 +0000 (20:03 +0200)
Popovers are hidden with display:none to disable any DOM interaction. Furthermore the popover is no longer triggered, if the link has no or empty 'href' attribute.

Fixes #849

wcfsetup/install/files/js/WCF.js

index 71a4571ecf1246f51096a217d16bea748ca05a6d..9d81eca62fff4087e8f216941bbf1e77bbf6f73c 100755 (executable)
@@ -5462,7 +5462,7 @@ WCF.Popover = Class.extend({
                                
                                $element.hover($.proxy(this._overElement, this), $.proxy(this._out, this));
                                
-                               if ($element.getTagName() === 'a') {
+                               if ($element.getTagName() === 'a' && $element.attr('href')) {
                                        $element.click($.proxy(this._cancel, this));
                                }
                        }
@@ -5563,7 +5563,7 @@ WCF.Popover = Class.extend({
                        return;
                }
                
-               this._popover.stop().css({ opacity: 1 }).wcfFadeIn();
+               this._popover.stop().show().css({ opacity: 1 }).wcfFadeIn();
                
                if (this._data[this._activeElementID].loading) {
                        this._loadContent();
@@ -5631,12 +5631,12 @@ WCF.Popover = Class.extend({
                this._popover.stop();
                
                if (disableAnimation) {
-                       self._popover.css({ opacity: 0 });
+                       self._popover.css({ opacity: 0 }).hide();
                        self._popoverContent.empty().css({ height: 'auto', opacity: 0, width: 'auto' });
                }
                else {
                        this._popover.wcfFadeOut(function() {
-                               self._popoverContent.empty().css({ height: 'auto', opacity: 0, width: 'auto' });
+                               self._popoverContent.empty().css({ height: 'auto', opacity: 0, width: 'auto' }).hide();
                        });
                }
        },