Skip to content

The variable pos has an undefined width in Internet Explorer because offsetWidth is not cross-browser. #188

@meatballcoder

Description

@meatballcoder

Hi, Not sure how to support or suggest a change to an Open Source project, but I was trying to use tipsy in IE 11 (and below, and Edge emulation as well), and the tooltip appeared all the way on the left of the screen. This worked correctly in Chrome, the tooltip over the element. The problem is that left is always "NaN" because "offsetWidth" is not a valid property for Internet Explorer.

If it matters, I am using this in conjunction with D3 with SVG graphs to add a tooltip to tree element.

I found this,

          var pos = $.extend({}, this.$element.offset(), {
                width: this.$element[0].offsetWidth,
                height: this.$element[0].offsetHeight
            });

And changed it to this,

         var pos = $.extend({}, this.$element.offset(), {
              width: this.$element.outerWidth(),
              height: this.$element.outerHeight()
         });

, and it started working in IE and continued to work in Chrome (and Firefox as well).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions