Changeset 9126

Show
Ignore:
Timestamp:
06/14/07 05:34:45 (19 months ago)
Author:
bill
Message:

Make tooltip appear on right, or on left for browsers with text-direction set to
right-to-left (middle eastern languages).

Add images/CSS rules for all orientations of tooltip.

Mostly working although have to fix handling when tooltip doesn't fit on right.

Fixes #3267, #3236

Location:
dijit/trunk
Files:
6 added
3 modified
2 moved

Legend:

Unmodified
Added
Removed
  • dijit/trunk/themes/dijit.css

    r9100 r9126  
    598598 
    599599 
    600  
    601  
    602  
    603600/**** 
    604601                dijit.Tooltip 
     
    609606        z-index: 10; 
    610607        display: block; 
    611         margin-top: 10px; 
    612608        /* make visible but off screen */ 
    613609        left: -10000px; 
  • dijit/trunk/themes/tundra/tundra.css

    r9106 r9126  
    1616        /* TODO: won't work; path is wrong; use gif instead? */ 
    1717        filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="dijitTundraGradientBg.png", sizingMethod="scale"); 
    18 } 
    19  
    20 .dj_ie6 .tundra .dijitTooltipConnector { 
    21         background-image: url(tooltipConnector.gif); 
    2218} 
    2319 
     
    496492 
    497493.tundra .dijitTooltip { 
     494        /* the outermost dom node, holding the connector and container */ 
    498495        opacity: 0.9; 
    499496} 
     
    501498.tundra .dijitTooltipContainer { 
    502499        /* 
     500                The part with the text. 
     501 
    503502                NOTE:  
    504503                        FF doesn't clip images used as CSS bgs if you specify a border 
     
    507506                background: #ffffff url("popupMenuBg.gif") repeat-x bottom left; 
    508507        */ 
    509         background-color: white; 
     508        background-color: #fafafa; 
    510509        border:1px solid #9b9b9b; 
    511510        padding:0.45em; 
     
    515514} 
    516515 
    517 .tundra .dijitTooltipConnector { 
     516.tundra .dijitTooltipConnect { 
     517        /* the arrow piece */ 
    518518        border:0px; 
     519        z-index: 2; 
     520} 
     521 
     522.tundra .dijitTooltipBelow { 
     523        margin-top: 13px; 
     524} 
     525.tundra .dijitTooltipBelow .dijitTooltipConnector { 
     526        /* the arrow piece for tooltips below an element */ 
    519527        top: -13px; 
    520528        left: 3px; 
    521         z-index: 2; 
    522         background:url("tooltipConnector.png") no-repeat top left; 
     529        background:url("images/tooltipConnectorUp.png") no-repeat top left; 
    523530        width:16px; 
    524531        height:14px; 
     532} 
     533.dj_ie6 .tundra .dijitTooltipBelow .dijitTooltipConnector { 
     534        background-image: url("images/tooltipConnectorUp.gif"); 
     535} 
     536 
     537.tundra .dijitTooltipAbove { 
     538        margin-bottom: 13px; 
     539} 
     540.tundra .dijitTooltipAbove .dijitTooltipConnector { 
     541        /* the arrow piece for tooltips above an element */ 
     542        bottom: -13px; 
     543        left: 3px; 
     544        background:url("images/tooltipConnectorDown.png") no-repeat top left; 
     545        width:16px; 
     546        height:14px; 
     547} 
     548.dj_ie6 .tundra .dijitTooltipAbove .dijitTooltipConnector { 
     549        background-image: url("images/tooltipConnectorDown.gif"); 
     550} 
     551 
     552.tundra .dijitTooltipLeft { 
     553        margin-right: 13px; 
     554} 
     555.tundra .dijitTooltipLeft .dijitTooltipConnector { 
     556        /* the arrow piece for tooltips to the left of an element, bottom borders aligned */ 
     557        right: -12px; 
     558        bottom: 7px; 
     559        background:url("images/tooltipConnectorRight.png") no-repeat top left; 
     560        width:16px; 
     561        height:14px; 
     562} 
     563.dj_ie6 .tundra .dijitTooltipLeft .dijitTooltipConnector { 
     564        background-image: url("images/tooltipConnectorRight.gif"); 
     565} 
     566 
     567.tundra .dijitTooltipRight { 
     568        margin-left: 13px; 
     569} 
     570.tundra .dijitTooltipRight .dijitTooltipConnector { 
     571        /* the arrow piece for tooltips to the right of an element, bottom borders aligned */ 
     572        left: -13px; 
     573        bottom: 7px; 
     574        background:url("images/tooltipConnectorLeft.png") no-repeat top left; 
     575        width:16px; 
     576        height:14px; 
     577} 
     578.dj_ie6 .tundra .dijitTooltipRight .dijitTooltipConnector { 
     579        background-image: url("images/tooltipConnectorLeft.gif"); 
    525580} 
    526581 
  • dijit/trunk/Tooltip.js

    r9058 r9126  
    3939 
    4040                show: function(/*String*/ innerHTML, /*DomNode*/ aroundNode){ 
    41                         // summary: display tooltip w/specified contents underneath specified node 
     41                        // summary: 
     42                        //      Display tooltip w/specified contents to right specified node 
     43                        //      (To left if there's no space on the right, or if LTR==right 
    4244 
    4345                        if(this.fadeOut.status() == "playing"){ 
     
    4749                        } 
    4850                        this.containerNode.innerHTML=innerHTML; 
    49                         dijit.util.placeOnScreenAroundElement(this.domNode, aroundNode, [0,0], 
    50                                 {'BL': 'TL', 'TL': 'BL'}); 
     51 
     52                        // position the element and change CSS according to position     
     53                        var align = this.isLeftToRight() ? {'BR': 'BL', 'BL': 'BR'} : {'BL': 'BR', 'BR': 'BL'}; 
     54                        dijit.util.placeOnScreenAroundElement(this.domNode, aroundNode, [0,0], align); 
     55                        // TODO: need to know which position placeOnScreenAroundElement picked 
     56                        this.domNode.className="dijitTooltip dijitTooltip" + (this.isLeftToRight() ? "Right" : "Left"); 
     57                         
     58                        // show it 
    5159                        dojo.style(this.domNode, "opacity", 0); 
    5260                        this.fadeIn.play();