enyo / opentip

Opentip is an open source javascript tooltip based on the protoype framework.
http://www.opentip.org
1.25k stars 401 forks source link

IE excanvas tip width #75

Open l0co opened 10 years ago

l0co commented 10 years ago

In IE working width excanvas there's an issue with tip width. If you have long text in the tip in single line, the width can be unlimited and your tip is displayed outside the visible area. For other browsers it works fine - it adjusts the tip width/height automatically.

Here is my patch for this:

Index: opentip-prototype-excanvas.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- opentip-prototype-excanvas.js   (revision 551)
+++ opentip-prototype-excanvas.js   (revision )
@@ -343,6 +343,15 @@
       top: "0px"
     });
     this.dimensions = this.adapter.dimensions(this.container);
+    if (isIE && this.dimensions.width>400) {
+        this.adapter.css(this.container, {
+            width: "400px",
+            height: "auto",
+            left: "0px",
+            top: "0px"
+        });
+        this.dimensions = this.adapter.dimensions(this.container);
+    }
     this.dimensions.width += 1;
     this.adapter.css(this.container, {
       width: "" + this.dimensions.width + "px",