Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooltip useHTML=true doesn't fadeOut #3542

Closed
tjhiggins opened this issue Oct 27, 2014 · 3 comments
Closed

Tooltip useHTML=true doesn't fadeOut #3542

tjhiggins opened this issue Oct 27, 2014 · 3 comments

Comments

@tjhiggins
Copy link

The tooltip html is just hidden as opposed to fading out like its svg counterpart. Can be ugly if you use svg tooltip background in tandem with html content.

http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/tooltip/fullhtml/

@pawelfus
Copy link
Contributor

Workaround: http://jsfiddle.net/71c56zx9/1/

And required snippet:

(function (H, HA) {
    H.wrap(H.SVGElement.prototype, 'show', function (p, inherit) {
        if (this.div) {
            HA.animate(this.div, {
                opacity: 1
            }, {
                duration: 0
            });
        }
        return p.call(this, inherit);
    });

    H.wrap(H.SVGElement.prototype, 'fadeOut', function (p, duration) {
        var elemWrapper = this;
        elemWrapper.animate({
            opacity: 0
        }, {
            duration: H.pick(duration, 150),
            complete: function () {
                elemWrapper.hide(); // #3088, assuming we're only using this for tooltips
            }
        });
        if (elemWrapper.div) {
            HA.animate(elemWrapper.div, {
                opacity: 0
            }, {
                duration: H.pick(duration, 150)
            });
        }
    });
})(Highcharts, HighchartsAdapter)

Internal note:
A bit connected to the #3088 - we can revert #3088, if we will manage wrapper.div element separately (by showing/hiding that element, instead of translating parent). As for example, see snippet above. Of course, in the fix, we can use css() for show, but for the workaround purposes I'm using animate() in show - css() is encapsulated and not available in Facade.js.

@TorsteinHonsi
Copy link
Collaborator

@pawelfus Resolved this by adding an opacitySetter to the HTML element. Animation hooks up to it.

@pawelfus
Copy link
Contributor

That's cool, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants