.tooltip()不是函数 [英] .tooltip() is not a function

查看:387
本文介绍了.tooltip()不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用从以下位置找到的.tooltip(): Jquery -ui工具提示.我所拥有的是一个Rails应用程序,该应用程序在表中具有一些信息.在单独的单元格中.当前,您可以通过单击它来查看单元格的完整信息,这将打开工作正常的jquery对话框.我要添加的内容是要有两个选择.

I am trying to use the .tooltip() that I found from the following: Jquery-ui tooltip. What I have is a rails app that has some information in a table. In separate cells. Currently you can view the full information of a cell by clicking it which opens up jquery dialog which works fine. What I am trying to add to it is so that there will be two options.

  • 1)单击弹出jquery对话框的单元格-该对话框已经起作用

  • 1) Click the cell which brings up jquery dialog - which works already

2)或将鼠标悬停在显示概述的单元格上.

2) Or hover a cell which shows an overview.

图像

在当前图像上,您可以单击预订,它将显示预订信息.但是,我正在尝试扩展它,以便用户可以选择单击以查看信息或将鼠标悬停在单元格上以查看信息.

From the image currently you have a booking that you can click on and it will show the booking information. However I am trying to extend it so that the user has the option of clicking to view the information or hovering over the cell to view the information.

做到这一点的最佳方法是什么?我有以下代码可以使用并打开对话框.我尝试添加:

What is the best way to do this? I have the following code which works with and brings up the dialog. I tried adding:

<td class="<%= booking.status %>" onmouseover='$("#booking<%= booking.id %>").tooltip()'>

之前,它不起作用,我可能理解它不起作用,因为两者之间会发生冲突.除此之外,我确实尝试过使用simpletip和qtip,但似乎没有运气.是我试图做的不可行.

before which didn't work, and I probably understand that it wouldn't work because there would be a conflict between the two. In addition to this I did try using simpletip and qtip but seemed to not have no luck. Is what I am trying to do not feasible.

<td class="<%= booking.status %>" onclick='$("#booking<%= booking.id %>").dialog()'>
  <center>
  <%= booking.reference_number %>
  <% if current_user.is_booking_manager? %>
    (<%= booking.company_name %>)
  <% end %>
</center>
<div style="display:none;">
  <% if not booking.provisional? or current_user.is_booking_manager? %>
    <div id="booking<%= booking.id %>" title="Booking Information">
  <% else %>
    <div id="booking<%= booking.id %>" title="Edit Booking">
  <% end %>
      <%= render :partial => "booking_dialog", :locals => { :booking => booking } %>
    </div>
  </div>
</td>

推荐答案

尝试执行以下操作.为了使工具提示起作用,您需要为控件设置title.

Try doing something like this. For tooltip to work, you will require title set for the control.

HTML

<td id="bookingTd" title="This is a tooltip." 
     class="<%= booking.status %>" 
     onclick='$("#booking<%= booking.id %>").dialog()'>

</td>

JavaScript

$(document).ready(function(){
   $("#bookingTd").tooltip();
});

还要确保先加载jQuery,然后再加载工具提示插件.

Also make sure you load jQuery first and then the tooltip plugin.

希望这对您有所帮助.

这篇关于.tooltip()不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆