2012-06-01 57 views
0

我有多個DIV元素在服務器端創建,然後在客戶端使用ASP .Net MVC Html.Raw Helper方法創建。我正在尋找在鼠標懸停上添加彈出窗口。每個DIV元素的彈出內容是不同的。我怎樣才能用JQuery或qTip來做到這一點?這裏是我的示例DIV元素。任何建議都會非常有幫助。在服務器端創建DIV元素的工具提示

<div class="gantt" style="border-width:medium;border-color:black;background:green;width:2%;margin-left:10%;">11</div> 
<div class="gantt" style="border-width:medium;border-color:black;background:green;width:7%;margin-left:12%;">11</div> 

我試圖找出我怎麼能創建服務器端彈出的文本,然後再使用jQuery它顯示爲鼠標懸停在一個彈出。

+6

爲什麼不讀書qTip文檔閱讀多少? http://craigsworks.com/projects/qtip2/tutorials/ – undefined

+0

@Raminson。對不起,不清楚。實際上,DIV元素是在運行時在服務器上創建的,然後使用ASP.Net MVC呈現給瀏覽器。 – user320587

回答

1

qTip也提供AJAX調用,所以您可以獲取必須在服務器彈出窗口內呈現的內容。

一個簡單的例子

$('.selector').qtip({ 
    content: { 
     text: 'Loading...', // The text to use whilst the AJAX request is loading 
     ajax: { 
      url: '/path/to/file', // URL to the local file 
      type: 'GET', // POST or GET 
      data: {} // Data to pass along with your request 
     } 
    } 
}); 

您可以從here