2012-04-17 60 views
0

我有一個css工具提示,我用它來提供指導,我正試圖將它包含在jqgrid中。Css懸停工具提示無法在JqGrid中工作

但是,懸停時會顯示該列的標題。 <span>沒有。我嘗試加入title:false,但沒有任何反應。

下面是我使用的CSS:

.tooltip { border-bottom:1px dotted #000000; outline:none; text-decoration:none; cursor:help; } 
.tooltip:hover em { padding: .2em 0 .6em 0; font-weight:bold; display:block; } 
.tooltip { position:relative; } 
.tooltip:hover span { position:absolute; left:1em; top:-4.5em; z-index:99; margin-left:0; width:150px; } 
.tooltip:hover em { border:0; margin: -10px 0 0 -55px; float:left; position:absolute; } 
.tooltip span { margin-left:-999em; position:absolute; } 

這裏就是它的應用:

<a class='tooltip' href='#'> 
<img alt='Help' src='/Images/question_mark_sm.png' /> 
<span class='tooltip_classic info'>Guidance Tag</span> 
</a> 

不知道爲什麼它會工作其他地方,但在jqGrid的。我嘗試過並嘗試過,但它似乎並不奏效。 (好吧,圖像顯示出來,光標發生變化,但沒有彈出窗口。)

+0

你不包括在內,代碼展示瞭如何使用'中的jqGrid tooltip'類。你使用自定義格式化程序嗎?你是否試圖增加'z-index'的值(在'.tooltip:hover span'的CSS中)爲1000? – Oleg 2012-04-17 22:06:32

+0

我們很可能需要上下文。可能還有一些與jqGrid相關的定位或上下文CSS導致工具提示被隱藏。 – 2012-04-17 22:07:39

+0

@ Oleg,是的,我將'z-index'增加到了9999,而它什麼都沒做。我沒有在jqGrid列中使用自定義格式化程序,我將上面發佈的html代碼作爲列條目之一發送,以便在jqGrid中顯示。沒有工具提示。 – Cody 2012-04-18 22:13:49

回答

1

嘗試從jqGrid單元中刪除工具提示屬性。

對我來說,它適用於除IE7以外的所有瀏覽器。我使用了jqGrig gridComplete事件。

下面是一個例子:

// _YourColID is you column name from colModel 
$("td[aria-describedby*=_YourColID]", "#yourGridID tr").removeAttr("title"); 
$("td[aria-describedby*=_YourColID]", "#yourGridID tr").tooltip({ 

    // each trashcan image works as a trigger 
    tip: '.tooltip', 

    // custom positioning 
    position: 'center right',     

    // move tooltip a little bit to the right 
    offset: [0, -10],     

    // there is no delay when the mouse is moved away from the trigger 
    delay: 0,     
    predelay: 2000,     
    onShow: function(e){ 
    if ($(e.target).parent("tr").attr('id') != -1) { 
     yourTooltipFunction($(e.target).parent("tr").attr("id")); 
    } 
    } 
}).dynamic({ 
    bottom: { 
    direction: 'down', 
    bounce: true 
    } 
});