2012-06-01 49 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