【问题标题】:JQuery tooltip (jQueryTool) error multiple instances on tableJQuery工具提示(jQueryTool)错误表上的多个实例
【发布时间】:2013-01-10 06:11:11
【问题描述】:

我正在使用“jquerytools” (http://jquerytools.org/download/) 开发的 jQuery 函数工具提示,我正在尝试在表中第一列的每一行调用多个回调。

这是javascript源代码:

$('#table1 tr td:nth-child(1)').each(function(){
    $(this).tooltip({
      bounce: "false",
      tip: $(this).children('.tableTooltip'),
      position: 'center right',
      offset: [0, 0],
      effect: "fade",
      relative: true,
      opacity: 1,
      delay: 300
    });
});

还有这张桌子:

<table id="table1">

  <tr><td> 
      Some content
      <div class="tooltip tableTooltip">
        <table><tr><td>My tooltip table</td></tr></table>
      </div>
  </td></tr>

  <tr><td> 
      Some other content
      <div class="tooltip tableTooltip">
        <table><tr><td>My other tooltip table</td></tr></table>
      </div>
  </td></tr>

</table>

代码似乎有效,当我将光标移到主表的第一个列上时,它会出现工具提示。 但是,当我将光标移到工具提示上时,我从 Firebug 收到此错误:

未捕获的异常:找不到 [object Object] 的工具提示

有人可以帮助我吗?任何提示都非常感谢!

【问题讨论】:

    标签: jquery tooltip jquery-tools jquery-tooltip


    【解决方案1】:

    这可能与初始化有关,因为我注意到工具提示仅在鼠标悬停后才会激活。我通过隐藏工具提示并将工具提示更改为不使用表进行了一些更改以消除初始化期间的任何问题,该表可能也已由您的 jquery 选择器选择。

    http://jsbin.com/ewagex/4 http://jsbin.com/ewagex/4/edit

      <table id="table1">
    
      <tr><td> 
          Some content
          <div class="tooltip tableTooltip">
            <div>My tooltip table</div>
          </div>
      </td></tr>
    
      <tr><td> 
          Some other content
          <div class="tooltip tableTooltip">
            <div>My other tooltip table</div>
          </div>
      </td></tr>
    
      <script>
        $('#table1 tr td:nth-child(1)').each(function(){
        $(this).children('.tableTooltip').hide();
        $(this).tooltip({
          bounce: "false",
          tip: $(this).children('.tableTooltip'),
          position: 'center right',
          offset: [0, 0],
          effect: "fade",
          relative: true,
          opacity: 1,
          delay: 300
        });
    });
        </script>
    

    【讨论】:

      猜你喜欢
      • 2017-05-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-15
      • 2023-03-24
      相关资源
      最近更新 更多